iPhone URL架构块safari错误警报
如果安装在iPhone上,我尝试通过safari浏览器打开我的应用程序,就像使用javascript文档传递iPhone URL架构块safari错误警报,iphone,ios,safari,url-scheme,Iphone,Ios,Safari,Url Scheme,如果安装在iPhone上,我尝试通过safari浏览器打开我的应用程序,就像使用javascript文档传递myApp://一样如果没有,则重定向到另一个网页以显示应用程序详细信息。但当应用程序未安装safari时抛出“无法打开页面”警报,如果重定向到另一个网页,此时safari警报框也不会自动关闭。 如果设备上未安装应用程序,任何人都可以帮助我在没有safari的情况下如何重定向网页无法打开页面警报 我的代码: 只需html文件和正文onload=“checkdevice();返回false;
myApp://一样代码>如果没有,则重定向到另一个网页以显示应用程序详细信息。但当应用程序未安装safari时抛出“无法打开页面”警报,如果重定向到另一个网页,此时safari警报框也不会自动关闭。
如果设备上未安装应用程序,任何人都可以帮助我在没有safari的情况下如何重定向网页无法打开页面警报
我的代码:
只需html文件和正文onload=“checkdevice();返回false;”
在textarea“document.getElementById('txtMsg').value”中显示消息
函数checkdevice()检查浏览器检测
{
if((navigator.userAgent.match(/iPhone/)| |(navigator.userAgent.match(/iPad/))| |(navigator.userAgent.match(/iPod/))
{
document.getElementById('txtMsg').value=“在iPhone/iPod/iPad设备上运行”;
checkAppExists();
返回true;
}
其他的
{
document.getElementById('txtMsg').value=“请在iPhone/iPod/iPad设备上运行此页面”;
checkAppExists();
返回false;
}
}
函数checkAppExists()
{
var time=(新日期()).getTime();
window.location=“myApp://”;
setTimeout(函数(){
var now=(new Date()).getTime();
如果((现在时间)<400)
{
window.location=”http://mydomin.com/appdetails.html";
}
其他的
{
document.getElementById('txtMsg')。value=“App Installed”;*应用程序将在此处启动*
}
},300);
}
您如何解决此问题?
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);
}