Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPhone URL架构块safari错误警报_Iphone_Ios_Safari_Url Scheme - Fatal编程技术网

iPhone URL架构块safari错误警报

iPhone URL架构块safari错误警报,iphone,ios,safari,url-scheme,Iphone,Ios,Safari,Url Scheme,如果安装在iPhone上,我尝试通过safari浏览器打开我的应用程序,就像使用javascript文档传递myApp://一样如果没有,则重定向到另一个网页以显示应用程序详细信息。但当应用程序未安装safari时抛出“无法打开页面”警报,如果重定向到另一个网页,此时safari警报框也不会自动关闭。 如果设备上未安装应用程序,任何人都可以帮助我在没有safari的情况下如何重定向网页无法打开页面警报 我的代码: 只需html文件和正文onload=“checkdevice();返回false;

如果安装在iPhone上,我尝试通过safari浏览器打开我的应用程序,就像使用javascript文档传递
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);

}