最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Execute Javascript in HTML file from within Android - Stack Overflow

programmeradmin3浏览0评论

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 0
Add a comment  | 

3 Answers 3

Reset to default 15

Call 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 your WebView

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.

  1. Android Calling JavaScript functions in WebView
  2. call javascript inside webview.
  3. calling javascript function.

Hope this links will be helpful to you.

发布评论

评论列表(0)

  1. 暂无评论