独立的Web应用程序链接脚本 - 阻止它附加具有特定类的链接?双

时间:2015-05-30 02:17:42

标签: jquery web-applications iphone-standalone-web-app

讨论后 - >这个帖子: standalone web app link script - stop it from appending links which have a specific class?

- > https://gist.github.com/kylebarrow/1042026

if(("standalone" in window.navigator) && window.navigator.standalone){ // If you want to prevent remote links in standalone web apps opening Mobile Safari, change 'remotes' to true
    var noddy, remotes = false; document.addEventListener('click', function(event) { noddy = event.target;

        // Bubble up until we hit link or top HTML element. Warning: BODY element is not compulsory so better to stop on HTML
        while(noddy.nodeName !== "A" && noddy.nodeName !== "HTML") {
            noddy = noddy.parentNode;
        }

        if('href' in noddy && noddy.href.indexOf('http') !== -1 && (noddy.href.indexOf(document.location.host) !== -1 || remotes))
        {
            event.preventDefault();
            document.location.href = noddy.href;
        }

    },false); }

有人能帮助我吗?我有同样的问题,但我不能用这个代码来解决它 - >

&& !$(noddy).hasClass('lightbox')

我不知道我可以在顶部的脚本中将它添加到哪里?

有什么想法解决它吗?还是有另一种解决方案吗?

最佳, 丽娜

0 个答案:

没有答案