kum*_*esh 5 iphone safari url-scheme ios
我尝试打开我的应用程序,如果从safari浏览器安装在iPhone中,只需传递,myApp:// using javascript document.location="myApp://";如果没有重定向到另一个网页,以显示应用程序详细信息.但是当app没有安装safari时抛出"无法打开页面"警报,如果重定向到另一个网页那个时候也会自动提醒警报框.如果应用程序没有安装在设备上,任何人都可以帮助我如何在没有safari的情况下重定向网页无法打开页面警报.
我的代码:简单地onload="checkdevice();return false;"
用textarea中的html文件和正文显示消息"document.getElementById('txtMsg').value"
function checkdevice() Check browser detection
{
if((navigator.userAgent.match(/iPhone/)) || (navigator.userAgent.match(/iPad/)) || (navigator.userAgent.match(/iPod/)))
{
document.getElementById('txtMsg').value ="Running on iPhone /iPod /iPad Device";
checkAppExists();
return true;
}
else
{
document.getElementById('txtMsg').value ="Please run this page on iPhone / iPod / iPad Device";
checkAppExists();
return false;
}
}
function checkAppExists()
{
var time = (new Date()).getTime();
window.location="myApp://";
setTimeout(function(){
var now = (new Date()).getTime();
if((now-time)< 400)
{
window.location="http://mydomin.com/appdetails.html";
}
else
{
document.getElementById('txtMsg').value ="App Installed"; * App will launch here *
}
},300);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
834 次 |
| 最近记录: |