Android WebView doesn't load jQuery

Viewed 44108

I'm making a webapp and I'm using jQuery.

I've made a simple android application with a WebView in it, and I load my url: www.mydomain.com

In mydomain.com I have:

<script src="js/jquery_1.4.2_min.js"></script> 

<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
 alert("Hii!!!!");
});
</script>

If I visit mydomain from the browser, the alert shows fine. But If I visit from my native application, it doesn't show. What can I do?

8 Answers

Correct sequence-

webview.getSettings().setJavaScriptEnabled(true); webview.loadUrl("file:///android_asset/xxx.html");

By mistake dont put your invocation sequence go wrong like below

webview.loadUrl("file:///android_asset/xxx.html"); webview.getSettings().setJavaScriptEnabled(true);

Related