html拉起app,ios利用scheme拉起app

ios利用scheme拉起app

作者: shaneZhang

发布时间: 2015-04-29 12:50

Open scheme(timeradio) defined in iPhone with parameters

open unknown with fallback to appstore

Only works on iPhone!

// To avoid the "protocol not supported" alert, fail must open another app.

var appstore = "itms://itunes.apple.com/cn/app/shi-guang-dian-tai/id734232598?mt=8";

function applink(fail){

return function(){

var clickedAt = +new Date;

// During tests on 3g/3gs this timeout fires immediately if less than 500ms.

setTimeout(function(){

// To avoid failing on return to MobileSafari, ensure freshness!

if (+new Date - clickedAt < 2000){

window.location = fail;

}

}, 500);

};

}

document.getElementById("applink1").onclick = applink(appstore);

document.getElementById("applink2").onclick = applink(appstore);

如果觉得我的文章对您有用,请随意打赏。如果有其他问题请联系博主QQ(909491009)或者下方留言!

打赏支持

发表评论您的电子邮箱地址不会被公开。 必填项已用*标注

*

*

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值