移动端 window.location.href 跳转app无效的问题

url地址是 market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen
我在网页上 用a连接href="market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen"可以跳转,
但是用 window.location.href= "market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen" 则无效,
求大神解答,

附上源码

<!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">测试一下</a>

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

setTimeout(function(){
    window.location.href = "http://www.baidu.com";//可以跳转
    window.location.href = "market://details?id=com.juphoon.justalk&referrer=utm_source=newheaderen";//不会跳转
},2000)

</script>
</html>

阅读 24.2k
3 个回答

你这是在webview里吗?

用这个可以 onclick="window.location = 'URL'

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题