11 Vote

JavaScript in Android WebView not working

Question by Guest | 2013-09-22 at 17:30

Within an Android App, I would like to display a website using a standard WebView. So far, that is perfectly working, the site displays correctly.

The only problem: The site contains JavaScript code that is not running in the WebView. Can it be that the WebView can not display dynamic content? Or do I have to do something else to activate JavaScript in WebView?

5Best Answer5 Votes

By default, JavaScript is disabled in the WebView.

Using the function setJavaScriptEnabled() you can change this behavior:

WebView wv = (WebView) findViewById(R.id.webView1); 

After this call, JavaScript should work.
2013-09-23 at 15:39

ReplyPositive Negative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.