现在的位置: 首页 > 综合 > 正文

只允许,同一域名下IFRAME,禁止直接访问页面

2017年11月11日 ⁄ 综合 ⁄ 共 267字 ⁄ 字号 评论关闭
/*
*只允许,同一域名下IFRAME
*凨来了
*/
var url='指定的iframe页面';
if ((parent.window.location.host != window.location.host) && (top.window.location.href != window.location.href)) {
    top.window.location.href = url;
}else if(top==self){
<span style="white-space:pre">	</span>top.window.location.href   =   url;
}

抱歉!评论已关闭.