2012-03-08 68 views
0

我有一個WebView的應用程序。在web視圖中,應用向用戶顯示具有啓動我的應用的鏈接的Internet頁面,但是在另一個活動中。 在HTML頁面中,我做這樣的事情WebView無法獲取onClick事件

<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
<html> 
<body> 
<button id="target" onClick="parent.location='my.special.scheme://other/parameters/here'" >Name</button> 
</body> 
</html> 

試試這個。 :)