Possible causes are as follows:
1, the HTML page on the JavaScript write problem, you can first debug in the HTML, such as the elimination of grammar problems;
2, the use of Webview.loadurl call when the string to be spelled correctly, especially when the parameter is passed, the format can be as follows:
Webview.loadurl ("Javascript:showdata ('" +json+ ")");
3, when the call may be the HTML page has not been loaded, using the handler post method, for example:
Private Handler Mhandler = new Handler ();
Mhandler.post (New Runnable () {
@Override
public void Run () {
Webview.loadurl ("Javascript:showdata ('" +json+ ")");
}
});
It can also be:
Webview.setwebviewclient (New Webviewclient () {
@Override
public void onpagefinished (WebView view, String URL) {
super.onpagefinished (view, URL);
Webview.loadurl ("Javascript:showdata (1)");
}
});
4. If the JavaScript alert does not pop out, set:
Webview.setwebchromeclient (New Webchromeclient () {});
No technical content, let's record.
Android and JavaScript Interactive report: Android uncaught Referenceerror: