鍍金池/ 問(wèn)答/iOS  Android  HTML/ 移動(dòng)端 window.location.href 跳轉(zhuǎn)app無(wú)效的問(wèn)題

移動(dòng)端 window.location.href 跳轉(zhuǎn)app無(wú)效的問(wèn)題

url地址是 market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen
我在網(wǎng)頁(yè)上 用a連接href="market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen"可以跳轉(zhuǎn),
但是用 window.location.href= "market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen" 則無(wú)效,
求大神解答,

附上源碼

<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8">
<title>Document</title>

</head>

<body>

<input type="text">
<a href="market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen">測(cè)試一下</a>

</body>
<script type="text/javascript">

setTimeout(function(){
    window.location.;//可以跳轉(zhuǎn)
    window.location.href = "market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen";//不會(huì)跳轉(zhuǎn)
},2000)

</script>
</html>

回答
編輯回答
笨小蛋

你這是在webview里嗎?

2017年7月11日 18:07
編輯回答
扯不斷

借花獻(xiàn)個(gè)佛,看下是不是這個(gè)原因,window.location.href 不跳轉(zhuǎn),如果不是貼上你那window.location.href前后的代碼我看看

2017年9月25日 21:05
編輯回答
浪蕩不羈

用這個(gè)可以 onclick="window.location = 'URL'

2018年1月5日 04:37