我有一个带有WebView的应用程序。在webview中,应用程序向用户显示一个Internet页面,该页面具有启动我的应用程序的链接,但在另一个Activity中。 在html页面中我做了类似
的事情<a href="my.special.scheme://other/parameters/here"></a>
一切都很顺利,但我需要用Javascript做同样的事情。所以这样做:
<html>
<head>
<script>
function redirect(n){
window.location = n;
}
</script>
</head>
<body>
<button id="target" onClick="redirect('my.special.scheme://other/parameters/here')" >Name</button>
</body>
</html>
但没有任何反应。 我使用的是Android 1.6
有什么建议吗?
答案 0 :(得分:1)
你有enable Javascript的观点吗?默认情况下禁用它(docs)。
答案 1 :(得分:0)
<html>
<body>
<button id="target" onClick="parent.location='my.special.scheme://other/parameters/here'" >Name</button>
</body>
</html>
试试这个。 :)