Why does webview. loadurl ("javascript: function ()") not run?

Source: Internet
Author: User

During the past few days, webview may occur, but sometimes webview. loadurl does not reflect the following situations:

Scenario 1: loading webview. loadurl is performed in another thread and must be completed in webview.

 

For example:

[Java] View
Plaincopy

  1. webview. loadurl ( " file: // android_asset/test1.html " );
  2. Webview. loadurl (& Quot; javascript: Alert (234567) & quot )");

If it is written like this, the effect of the second sentence may not be visible. Cause: loadurl is executed asynchronously. The second sentence may be followed first.

In the second case, there is an error in the added HTML Js. This error is difficult to debug and often cannot be found for a long time. In this case, we should be more careful, just like registering an object with JS

When the addjavainterface object is used, the injection object fails to be called and cannot be executed successfully.

Related Article

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.