JavaScript Not Working in Android Webview

JavaScript not working in Android Webview?

FIXED!
Spurred on by the error, I found out that I needed to set

setDomStorageEnabled(true)

for the webview settings.

Thanks for your help Stephan :)

Javascript not working in a WebView Activity

Set this setting as well for your webView:

WebSettings settings = webView.getSettings();
settings.setDomStorageEnabled(true);

For Detail refer to answer in the following link:
ERROR/Web Console: Uncaught TypeError: Cannot call method 'getItem' of null at http://m.youtube.com/:844

Update:
or adding this might help:

webView.loadDataWithBaseURL("fake://fake.com", myString, "text/html", "UTF-8", null);

Android WebView not loading javascript files or functions even after enabling javascript

I can't figure out the problem with the Nox Player, but I am able to have it worked in Vivo 11, and Vivo 11 Pro which has Funtouch OS 4.5 (based on Android 8.1) also the android emulator. Initially when I installed the app the webview showed the error 'net:ERR_CLEARTEXT_NOT_PERMITTED'. Then I added this line in manifest file 'android:usesCleartextTraffic="true"' in the 'application' tag and it worked without any issues. all the javascript files/functions are loading properly. Thanks everyone for the inputs.



Related Topics



Leave a reply



Submit