Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android's Webview cannot handle javascript?

My android application displays webpages(i used webview for it). .but javascript onthe wepage is not running in a webview .If i visit the same webpage through the Browser,javascript is running . How to run javascript in an application(using a webview)?

like image 387
rimpo Avatar asked Aug 10 '10 15:08

rimpo


2 Answers

Enable Javascript! :

WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);

WebView : setJavaScriptEnabled

like image 106
Jorgesys Avatar answered Sep 19 '22 22:09

Jorgesys


From the Android documentation:

"By default, a WebView provides no browser-like widgets, does not enable JavaScript and web page errors are ignored. If your goal is only to display some HTML as a part of your UI, this is probably fine; the user won't need to interact with the web page beyond reading it, and the web page won't need to interact with the user. If you actually want a full-blown web browser, then you probably want to invoke the Browser application with a URL Intent rather than show it with a WebView.

...

However, you can modify the WebSettings, such as enabling JavaScript with setJavaScriptEnabled()."

like image 30
Timothy Lee Russell Avatar answered Sep 23 '22 22:09

Timothy Lee Russell