Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.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
Javascript 支持apple mobile web app的常见问题解答链接在safari中打开_Javascript_Html_Css_Iphone Web App - Fatal编程技术网

Javascript 支持apple mobile web app的常见问题解答链接在safari中打开

Javascript 支持apple mobile web app的常见问题解答链接在safari中打开,javascript,html,css,iphone-web-app,Javascript,Html,Css,Iphone Web App,我花了一整天的时间在我的网站上添加移动网络应用。 现在一切正常-链接保留在应用程序中,不会在safari中打开,嵌入youtube视频的页面现在打开,但常见问题解答页面部分跳转链接在safari中仍然打开。。。现在唯一能做的 我使用了下面的代码 <meta name="apple-mobile-web-app-capable" content="yes"> <script type="text/javascript"> (function(document,na

我花了一整天的时间在我的网站上添加移动网络应用。 现在一切正常-链接保留在应用程序中,不会在safari中打开,嵌入youtube视频的页面现在打开,但常见问题解答页面部分跳转链接在safari中仍然打开。。。现在唯一能做的

我使用了下面的代码

<meta name="apple-mobile-web-app-capable" content="yes">

<script type="text/javascript">
    (function(document,navigator,standalone) {
        // prevents links from apps from oppening in mobile safari
        // this javascript must be the first script in your <head>
        if ((standalone in navigator) && navigator[standalone]) {
            var curnode, location=document.location, stop=/^(a|html)$/i;
            document.addEventListener('click', function(e) {
                curnode=e.target;
                while (!(stop).test(curnode.nodeName)) {
                    curnode=curnode.parentNode;
                }
                // Condidions to do this only on links to your own app
                // if you want all links, use if('href' in curnode) instead.
                if(
                    'href' in curnode && // is a link
                    (chref=curnode.href).replace(location.href,'').indexOf('#') && // is not an anchor
                    (   !(/^[a-z+.-]+:/i).test(chref) ||                       // either does not have a proper scheme (relative links)
                        chref.indexOf(location.protocol+'//'+location.host)===0 ) // or is in the same protocol and domain
                ) {
                    e.preventDefault();
                    location.href = curnode.href;
                }
            },false);
        }
    })(document,window.navigator,'standalone');
</script>

(功能(文档、导航器、独立){
//防止来自应用程序的链接在mobile safari中出现
//此javascript必须是您的应用程序中的第一个脚本
if((导航器中的独立)和&navigator[独立]){
var curnode,location=document.location,stop=/^(a | html)$/i;
document.addEventListener('click',函数(e){
curnode=e.target;
while(!(停止).test(curnode.nodeName)){
curnode=curnode.parentNode;
}
//有条件仅在指向您自己应用程序的链接上执行此操作
//如果需要所有链接,请改用if('href'在curnode中)。
如果(
curnode&&//中的“href”是一个链接
(chref=curnode.href).replace(location.href',).indexOf('#')&&&//不是锚定
(!(/^[a-z+.-]+:/i).test(chref)| |//或者没有正确的方案(相对链接)
chref.indexOf(location.protocol+'/'+location.host)==0)//或位于同一协议和域中
) {
e、 预防默认值();
location.href=curnode.href;
}
},假);
}
})(文档,window.navigator,'standalone');
我的跳转链接代码是:

<span class="faq-link"><a href="#faq-1">Where are...?</a></span>

只要单击顶部的问题,Safari就会打开


谢谢你的帮助。

有人能帮我吗?