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
- webview. loadurl ( " file: // android_asset/test1.html " );
- 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.