Cross Domian iFrame Exceptions 跨域iFrame屏蔽例外

来源:互联网 发布:中国人工智能产品展会 编辑:程序博客网 时间:2024/06/07 08:51


var frameBustingRegex = /^(https?:\/\/)?(www|beta)\.foo1\.com(\/.*|$)|^(https?:\/\/)?www\.foo2\.com(\/.*|$)|www\.foo3\.com/;



        if (self != top) {
            var httpUrlHost= ServerSide.URLHOST
            var httpRefHost=ServerSide.UrlReferrer.Host
            if(httpRefHost)
            {
                var httpReferer=ServerSide.Refer
                if(httpUrlHost!=httpRefHost
                   &&!frameBustingRegex.test(httpReferer))
                {
                    top.location = self.location;
                }
            }
        } 
原创粉丝点击