APP应用内嵌h5页面怎么直接打开Safari来访问链接?

APP应用内嵌h5页面,想点击链接通过Safari打开访问,但是试了很多方法,一直停留在App面,跪求解决方案!在此先谢谢啦


侃侃无极
浏览 6442回答 2
2回答

慕桂英4014372

var openApp=function(){ &nbsp; &nbsp;var localUrl=createScheme(); &nbsp; &nbsp;var openIframe=createIframe(); &nbsp; &nbsp;if(isIos()){ &nbsp; &nbsp; &nbsp; &nbsp;//判断是否是ios,具体的判断函数自行百度 &nbsp; &nbsp; &nbsp; &nbsp;window.location.href = localUrl; &nbsp; &nbsp; &nbsp; &nbsp;var loadDateTime = Date.now(); &nbsp; &nbsp; &nbsp; &nbsp;setTimeout(function () { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var timeOutDateTime = Date.now(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (timeOutDateTime - loadDateTime < 1000) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;window.location.href = "你的下载页面"; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;}, 25); &nbsp; &nbsp;}else if(isAndroid()){ &nbsp; &nbsp; &nbsp; &nbsp;//判断是否是android,具体的判断函数自行百度 &nbsp; &nbsp; &nbsp; &nbsp;if (isChrome()) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//chrome浏览器用iframe打不开得直接去打开,算一个坑 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;window.location.href = localUrl; &nbsp; &nbsp; &nbsp; &nbsp;} else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//抛出你的scheme &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;openIframe.src = localUrl; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;setTimeout(function () { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;window.location.href = "你的下载页面"; &nbsp; &nbsp; &nbsp; &nbsp;}, 500); &nbsp; &nbsp;}else{ &nbsp; &nbsp; &nbsp; &nbsp;//主要是给winphone的用户准备的,实际都没测过,现在winphone不好找啊 &nbsp; &nbsp; &nbsp; &nbsp;openIframe.src = localUrl; &nbsp; &nbsp; &nbsp; &nbsp;setTimeout(function () { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;window.location.href = "你的下载页面"; &nbsp; &nbsp; &nbsp; &nbsp;}, 500); &nbsp; &nbsp;}}看你怎么用了
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

iOS