【发布时间】:2013-12-01 16:04:29
【问题描述】:
我正在将我的网站移植到 Android,并使用 Webview 向用户显示内容。我的网站中有很多Javascript函数,我想拦截它们。我已经看过a "solution" here。
不过,我认为应该有更合适的方式,使用 Javascript 接口:
this.webView.addJavascriptInterface(this.webJavascriptInterface, "Android");
这样,我必须修改我的网站以同时调用myFunction() 和Android.myFunction()。我试图在界面中留下一个空白字符串:
this.webView.addJavascriptInterface(this.webJavascriptInterface, "");
但结果和我猜的一样,它无法工作。有没有办法在 Webview 中覆盖当前的 Javascript 函数?
【问题讨论】:
标签: javascript android interface webview