The frameKiller that I’m using.

top.location.hostname表示上层的域名,正常情况下和self应该是一样的。但是这个属性如果跨域是不能直接存取的,所以只要捕获到访问top.location.hostname出现错误,说明就在frame里面了。
弄那个throw 1 是为了兼容Chrome。Chrome和有些浏览器不能跨域存取的错误catch不到的。

Author Info :
  • From:The frameKiller that I’m using.
  • URL:https://blog.ihipop.com/2013/10/3581.html
  • Please Reserve This Link,Thanks!
  • 《The frameKiller that I’m using.》上有3条评论

    回复 ihipop 取消回复

    您的电子邮箱地址不会被公开。 必填项已用*标注