Javascript-H5 page how to interact with the APP?

Source: Internet
Author: User
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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.