Comparative introduction between iOS and JS interaction methods
What are the differences between iOS and JS interaction methods? This article makes a simple comparison of the current interaction methods between iOS and JS. You can take a look if necessary.
Just a comparison of the currently existing interaction methods. There will be no implementation involved. If you need to know the specific usage. You can use Baidu or Google.
Interception protocol
The interception protocol is the simplest interaction method. It intercepts directly on the Android side and iOS side, and can unify the web front-end code. The web front end takes parameters in the link. For example:
88gongxiang://loginFunc&name=xxx&pwd=123456. The scheme of intercepting the url is equal to 88gongxiang. It is intercepted by Native and processed by itself.
JavaScriptCore
After iOS7, Apple launched the JavaScriptCore framework, which makes it very convenient for web pages to interact with local native applications, and using this framework can make Android and iOS relatively unified. The web front-end can adapt to the two client platforms by writing a set of codes, thereby reducing the workload of the web front-end.
Third-party framework WebViewJavaScriptBridge
WebViewJavaScriptBridge is currently a popular JS interactive framework for iOS. WebViewJavaScriptBridge is encapsulated based on the interception protocol. Supports both UIWebview and WKWebview. However, the corresponding code needs to be embedded in the web front-end. At the same time, the web front-end code needs to comply with the regulations of WebViewJavaScriptBridge and cannot be unified with Android.
WKWebview
WKWebview is a browser component provided after iOS 8. When JS interacts with WKWebview, JS calls window.webkit.messageHandlers to send messages and call Native. It is impossible to unify the code on the web side.
The above interaction methods are determined according to different needs. The following can be used as a reference:
If the web side is short of manpower or wants to perform unified processing, JavaScriptCore and interception can be used method of agreement. If it is a simple interactive method, just use the interception protocol directly.
The third-party frameworks WebViewJavaScriptBridge and WKWebview require the cooperation of the web side.
Just a comparison of the currently existing interaction methods. There will be no implementation involved. If you need to know the specific usage. You can use Baidu or Google.
Related recommendations:
Interaction between native iOS and js
Detailed explanation and implementation code of interaction between javascript and IOS ObjectC
The above is the detailed content of Comparative introduction between iOS and JS interaction methods. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Article discusses creating, publishing, and maintaining JavaScript libraries, focusing on planning, development, testing, documentation, and promotion strategies.

The article discusses strategies for optimizing JavaScript performance in browsers, focusing on reducing execution time and minimizing impact on page load speed.

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

The article discusses effective JavaScript debugging using browser developer tools, focusing on setting breakpoints, using the console, and analyzing performance.

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

The article explains how to use source maps to debug minified JavaScript by mapping it back to the original code. It discusses enabling source maps, setting breakpoints, and using tools like Chrome DevTools and Webpack.

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...
