【发布时间】:2012-11-27 20:43:08
【问题描述】:
我正在注入此 JS 以在运行时获取 navigating url (destination)。我收到 JS 异常。怎么了?
static String NAVIGATING_FUNCTION = "window.onbeforeunload = function(){ window.external.notify(' + location.href + ''); };";
webView.InvokeScript("eval", new String[] { NAVIGATING_FUNCTION });
另外请告诉我如何cancel the navigation并使用此JS返回上一页?
【问题讨论】:
-
你在函数末尾的引用搞砸了;尝试粘贴到编辑器中进行更正。此外,如果您想取消导航,请在
onbeforeunload处理程序的末尾尝试return false。
标签: javascript webview windows-8 microsoft-metro