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.
我正在使用Android,我有一个包含一些Javascript的HTML文件。但是,我无法获取要执行的Javascript代码。为了运行此代码,我需要做什么?在此先感谢您的帮助。
3 个解决方案
#1
15
Call getSettings().setJavaScriptEnabled(true)
on your WebView
, as JavaScript is disabled by default.
在WebView上调用getSettings()。setJavaScriptEnabled(true),因为默认情况下禁用JavaScript。
#2
6
@raj asked for credible and/or official sources
@raj要求可靠和/或官方消息来源
@CommonsWare answered:
Call
getSettings().setJavaScriptEnabled(true)
on yourWebView
在WebView上调用getSettings()。setJavaScriptEnabled(true)
A simple search for the Android documentation provides the following official sources:
对Android文档的简单搜索提供以下官方来源:
#3
0
Here are few sources that will be surly helpful to you.
以下是一些对您有帮助的消息来源。
- Android Calling JavaScript functions in WebView
- call javascript inside webview.
- calling javascript function.
Android在WebView中调用JavaScript函数
在webview中调用javascript。
调用javascript函数。
Hope this links will be helpful to you.
希望这个链接对您有所帮助。
#1
15
Call getSettings().setJavaScriptEnabled(true)
on your WebView
, as JavaScript is disabled by default.
在WebView上调用getSettings()。setJavaScriptEnabled(true),因为默认情况下禁用JavaScript。
#2
6
@raj asked for credible and/or official sources
@raj要求可靠和/或官方消息来源
@CommonsWare answered:
Call
getSettings().setJavaScriptEnabled(true)
on yourWebView
在WebView上调用getSettings()。setJavaScriptEnabled(true)
A simple search for the Android documentation provides the following official sources:
对Android文档的简单搜索提供以下官方来源:
#3
0
Here are few sources that will be surly helpful to you.
以下是一些对您有帮助的消息来源。
- Android Calling JavaScript functions in WebView
- call javascript inside webview.
- calling javascript function.
Android在WebView中调用JavaScript函数
在webview中调用javascript。
调用javascript函数。
Hope this links will be helpful to you.
希望这个链接对您有所帮助。