手机端web页面,怎么判断ios是否安装了某个app?

手机端web页面,怎么判断ios是否安装了某个app?

慕盖茨4494581
浏览 1155回答 1
1回答

慕慕森

这个问题segmentfault上有.&nbsp;IOS 网页能判断有没有安装应用很久没去看了. 试试:<script language="javascript">&nbsp;&nbsp;&nbsp;if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {&nbsp;&nbsp;&nbsp; var loadDateTime = new Date();&nbsp;&nbsp;&nbsp; window.setTimeout(function() {&nbsp;&nbsp;&nbsp; &nbsp;var timeOutDateTime = new Date();&nbsp;&nbsp;&nbsp; &nbsp;if (timeOutDateTime - loadDateTime < 5000) {&nbsp;&nbsp;&nbsp; &nbsp; window.location = "要跳转的页面URL";&nbsp;&nbsp;&nbsp; &nbsp;} else {&nbsp;&nbsp;&nbsp; &nbsp; window.close();&nbsp;&nbsp;&nbsp; &nbsp;}&nbsp;&nbsp;&nbsp; },&nbsp;&nbsp;&nbsp; 25);&nbsp;&nbsp;&nbsp; window.location = " apps custom url schemes ";&nbsp;&nbsp;&nbsp;} else if (navigator.userAgent.match(/android/i)) {&nbsp;&nbsp;&nbsp; var state = null;&nbsp;&nbsp;&nbsp; try {&nbsp;&nbsp;&nbsp; &nbsp;state = window.open("apps custom url schemes ", '_blank');&nbsp;&nbsp;&nbsp; } catch(e) {}&nbsp;&nbsp;&nbsp; if (state) {&nbsp;&nbsp;&nbsp; &nbsp;window.close();&nbsp;&nbsp;&nbsp; } else {&nbsp;&nbsp;&nbsp; &nbsp;window.location = "要跳转的页面URL";&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</script>&nbsp;
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript