js中if (top.location = self.location) {top.location=self.location;}是什么意思.

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/08 17:10:50

js中if (top.location = self.location) {top.location=self.location;}是什么意思.
js中if (top.location = self.location) {top.location=self.location;}是什么意思.

js中if (top.location = self.location) {top.location=self.location;}是什么意思.
top.location != self.location 就是说当前窗体的url和父窗体的 url是不是相同
如果相同执行top.location=self.location;},把窗体的url设成和本窗体一样.这个是为了防止别的网站嵌入你的网站的内容(比如用iframe嵌入的你的网站的页面)