I have app with Webview with setting:
我在Webview中设置了以下设置:
wvPage = new WebView(this);
WebSettings webSettings = wvPage.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setDomStorageEnabled(true);
wvPage.setWebViewClient(new WebViewClient());
wvPage.setWebChromeClient(new WebChromeClient();
I loaded some url by using loadUrl("http://some.url/
") and start clicking on some references. Some of clicked references didn't open. I inspect code of this page:
我使用loadUrl(“http://some.url/”)加载了一些url并开始点击一些引用。部分点击引用未打开。我检查了这个页面的代码:
These refs opened normally:
这些参考正常打开:
<a href="http://some.url">some text</a>
These refs didn't open:
这些参考没有打开:
<a value="http://some.url">some text</a>
I tryed to check this issue in default browser in my tab. All works fine. Then I uncheck JS support in setting of the browser. After that default browser began to behave like my webview. So I decided that problem is in JS setting. But my webview executed some JS scenarios before I started clicking on refs and furthermore getJavaScriptEnabled() gave me true result;
我试图在我的选项卡中的默认浏览器中检查此问题。一切正常。然后我在设置浏览器时取消选中JS支持。之后,默认浏览器开始表现得像我的webview。所以我认为问题出在JS设置中。但是在我开始点击refs之前我的webview执行了一些JS场景,而且getJavaScriptEnabled()给了我真实的结果;
Are there any other permissions or supersecret settings which I need to turn on/off or whatever else?
是否有其他权限或超级秘密设置我需要打开/关闭或其他什么?
1 个解决方案
#1
0
I ended up just editing the HTML files, such that changed the Javascript source files to inline Javascript. That worked (as I expected it would).
我最后只是编辑HTML文件,这样就将Javascript源文件更改为内联Javascript。这有效(正如我预期的那样)。
But hope this link help full for you
但希望这个链接对你有所帮助
Android webview doesn't execute javascript from script src
Android webview不会从脚本src执行javascript
Android Webview HTML Loading Javascript Problem
Android Webview HTML加载Javascript问题
#1
0
I ended up just editing the HTML files, such that changed the Javascript source files to inline Javascript. That worked (as I expected it would).
我最后只是编辑HTML文件,这样就将Javascript源文件更改为内联Javascript。这有效(正如我预期的那样)。
But hope this link help full for you
但希望这个链接对你有所帮助
Android webview doesn't execute javascript from script src
Android webview不会从脚本src执行javascript
Android Webview HTML Loading Javascript Problem
Android Webview HTML加载Javascript问题