top.location与this.location

top.location != this.location 就是说当前窗体的url和父窗体的 url不相同(url主要是指是否为同一个域)

通常情况下的用法为:

if(top.location != this.location){

    top.location=this.location;

}

这个主要是为了防止别的网站嵌入你的网站(比如用iframe嵌入其他网站)




H-L
发布了8 篇原创文章 · 获赞 5 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/helenwei2017/article/details/80048459