安卓:
plus -> distribute -> google 下添加 schemes模块:
"schemes": [
"test"
],
ios:plus -> distribute -> apple 下添加urltypes模块
"urltypes": [{
"urlidentifier":"io.dcloud.Test",
"urlschemes":[
"'text'"
]
}],
调用 <a href="text://" target="_self" id="btn">连接到指定app</a>
<script type="text/javascript">
//假如没有指定app,则会跳到下载页面
function applink(){
return function(){
var clickedAt = +new Date;
setTimeout(function(){
!window.document.webkitHidden && setTimeout(function(){
if (+new Date - clickedAt < 2000){
window.location = 'http://下载地址';
}
}, 500);
}, 500)
};
}
document.getElementById("btn").onclick = applink();
</script>