我有一个网站,它包含一个带有链接的textField
<a class="xyz-icon" href="javascript:print()">
我想制作一个使用webview的Android应用程序,但是当我单击该字段时什么也不做。它可以在浏览器中使用。 我的Webview配置为:
webview.settings.javaScriptEnabled = true
Webview.settings.javaScriptCanOpenWindowsAutomatically = true
Webview.settings.domStorageEnabled = true
Webview.settings.loadWithOverviewMode = true
答案 0 :(得分:0)
我发现我必须将js注入放入onPageFinished
方法中,因为每次导航都会删除js。
所以我做了一个JS接口like this
然后onPageFinished
中的内容像myWebView.loadUrl(“javascript:(js code)“)