js判断当前窗口是否是顶级窗口

来源:互联网 发布:台湾网络节点是什么 编辑:程序博客网 时间:2024/05/16 16:15
if (window.top !== window.self) { // are you trying to put self in an iframe?  try {    if (window.top.location.host) { // this is illegal to access unless you share a non-spoofable document domain      // fun times    } else {      bust(); // chrome executes this    }  } catch (ex) {    bust(); // everyone executes this  }}


原创粉丝点击