点击按钮跳转app,否则跳转appstore 进行下载

var isAndroid = navigator.userAgent.toLowerCase().indexOf('android') > -1 || navigator.userAgent.toLowerCase().indexOf('adr') > -1;

if(isAndroid){

    window.location.href="https://play.google.com/store/apps/details?id=com.starmakerinteractive.starmaker&hl=zh_CN"
}else{
    setTimeout(function () {
        window.location.href = "https://itunes.apple.com/us/app/starmaker-sing-+-video-+-auto/id342138881?mt=8"
    },3000);
    window.location.href= "fb213560439114://";
}


这种在用户没有下载app。,点击跳转的时候safari提示网页地址无效,

然后我才用了这种方式
 var ifr = document.createElement('iframe');
ifr.src = 'fb213560439114://';
ifr.style.display = 'none';
document.body.appendChild(ifr);
window.setTimeout(function(){
    document.body.removeChild(ifr);
},3000)

这种不会自动跳转到app里面 。这种会一直跳转到app store 。有没有更优雅的办法
阅读 4.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题