js防止运营商劫持

<script type="text/javascript">
    // FUCK 运营商劫持
    var clearFrameAds = function () {
        var iframes = document.getElementsByTagName('iframe')

        for (var i = 0; i < iframes.length; i++) {
            var iframe = iframes[i]
            if (iframe.src && iframe.src.search('http://websitename.com/') !== 0) {
                iframe.parentNode.removeChild(iframe)
            }
        }
    }

    setInterval(function () {
        clearFrameAds()
    }, 2000)
</script>

js防止运营商劫持 

posted @ 2015-04-29 14:41  Mrxia  阅读(1065)  评论(0编辑  收藏  举报