I am using Android and I have an HTML file which contains some Javascript. However, I am not able to get the Javascript code to execute. What do I need to do in order to run this code? Thanks in advance for any help.
I am using Android and I have an HTML file which contains some Javascript. However, I am not able to get the Javascript code to execute. What do I need to do in order to run this code? Thanks in advance for any help.
Share Improve this question edited Apr 18, 2011 at 14:42 Donut 113k20 gold badges135 silver badges147 bronze badges asked Apr 18, 2011 at 14:37 rajraj 7536 silver badges21 bronze badges 03 Answers
Reset to default 15Call getSettings().setJavaScriptEnabled(true)
on your WebView
, as JavaScript is disabled by default.
@raj asked for credible and/or official sources
@CommonsWare answered:
Call
getSettings().setJavaScriptEnabled(true)
on yourWebView
A simple search for the Android documentation provides the following official sources:
- https://developer.android.com/reference/android/webkit/WebView.html
- https://developer.android.com/reference/android/webkit/WebSettings.html#setJavaScriptEnabled%28boolean%29
Here are few sources that will be surly helpful to you.
- Android Calling JavaScript functions in WebView
- call javascript inside webview.
- calling javascript function.
Hope this links will be helpful to you.