Perform an activity and embed an H5 page in the app. How does one allow users to click the button on the H5 page to jump to another page of the APP? For example, click the recharge button on the H5 page to go to the recharge page, and click the Buy Now button to go to the product page. How does H5 interact with the APP? do an activity and embed an H5 page in the app.
How does one allow users to click the button on the H5 page to jump to another page of the APP?
For example, click the recharge button on the H5 page to go to the recharge page, and click the Buy Now button to go to the product page.
How does H5 interact with the APP?
What should I do in the background?
Is there an example?
Please advise me.
Reply content:
Perform an activity and embed an H5 page in the app.
How does one allow users to click the button on the H5 page to jump to another page of the APP?
For example, click the recharge button on the H5 page to go to the recharge page, and click the Buy Now button to go to the product page.
How does H5 interact with the APP?
What should I do in the background?
Is there an example?
Please advise me.
The above methods are quite good. But in fact, it's just a jump problem, and it doesn't need to be so complicated.
Capture the jump information from the webview, and discuss the interface with the android client in the previous section, so you can directly process it.
For example, there is a jump in the web
Redirect settings
After clicking this button, the shouldOverrideUrlLoading function in webview is displayed. for Android:
WebView. setWebViewClient (new WebViewClient () {@ Override public boolean shouldOverrideUrlLoading (WebView view, String url) {L. I (url); // Obtain example: // jumpToSettings, and then the optionUrl (url) is processed by the string; // if it is a jump string, return true; // consume, do not allow webpage jump} @ Override public void onPageStarted (WebView view, String url, Bitmap favicon) {// super. onPageStarted (view, url, favicon );}});
JavaScriptCoreMany examples on the Internet, apple documentation is also very detailed
For Android, WebView can load H5. js code in H5 can be as follows: