gpt4 book ai didi

javascript - 如何在 webView 中启用 javascript

转载 作者:IT老高 更新时间:2023-10-28 21:42:23 26 4
gpt4 key购买 nike

在 android 中,如果我在 webView 中使用 javascript,它会强制关闭。有没有可能在 webView 中使用 java 脚本。请帮忙...

01-10 10:08:51.513: W/dalvikvm(5994): JNI WARNING: jarray 0x407447a8 points to non-array object (Ljava/lang/String;)
01-10 10:08:51.513: I/dalvikvm(5994): "WebViewCoreThread" prio=5 tid=9 NATIVE
01-10 10:08:51.513: I/dalvikvm(5994): | group="main" sCount=0 dsCount=0 obj=0x40567400 self=0x1f9e58
01-10 10:08:51.513: I/dalvikvm(5994): | sysTid=6010 nice=0 sched=0/0 cgrp=default handle=2269896
01-10 10:08:51.513: I/dalvikvm(5994): | schedstat=( 44479977019 41285891893 14352 )
01-10 10:08:51.513: I/dalvikvm(5994): at android.webkit.WebViewCore.nativeTouchUp(Native Method)
01-10 10:08:51.513: I/dalvikvm(5994): at android.webkit.WebViewCore.nativeTouchUp(Native Method)
01-10 10:08:51.543: I/dalvikvm(5994): at android.webkit.WebViewCore.access$3300(WebViewCore.java:53)
01-10 10:08:51.543: I/dalvikvm(5994): at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1158)
01-10 10:08:51.543: I/dalvikvm(5994): at android.os.Handler.dispatchMessage(Handler.java:99)
01-10 10:08:51.543: I/dalvikvm(5994): at android.os.Looper.loop(Looper.java:123)
01-10 10:08:51.543: I/dalvikvm(5994): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:629)
01-10 10:08:51.557: I/dalvikvm(5994): at java.lang.Thread.run(Thread.java:1019)
01-10 10:08:51.557: E/dalvikvm(5994): VM aborting

最佳答案

默认情况下,WebView 中禁用 JavaScript。

WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);

关于javascript - 如何在 webView 中启用 javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8846077/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com