Issue
How to add JQuery library into page loaded in Android WebView? My WebView with page:
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl(url);
Solution
I had to remove escapes from js code (like \n
). Also I had to wait untill JQuery is loaded:
load.tryReady = function(time_elapsed) {
// Continually polls to see if jQuery is loaded.
if (typeof $ == "undefined") { // if jQuery isn't loaded yet...
if (time_elapsed <= 5000) { // and we havn't given up trying...
setTimeout("load.tryReady(" + (time_elapsed + 200) + ")", 200); // set a timer to check again in 200 ms.
} else {
alert("Timed out while loading jQuery.")
}
} else {
// Any code to run after jQuery loads goes here!
}
}
http://www.coderanch.com/t/504284/HTML-CSS-JavaScript/dynamically-load-jQuery-javascript-library
Answered By - Taras
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.