window.top.location vs window.location [英] window.top.location vs window.location

查看:215
本文介绍了window.top.location vs window.location的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何同步window.top.location和window.location?

how to sync window.top.location and window.location?

推荐答案

这是你如何设置父的框架(顶部)到框架文件的位置......

This is how you set the parent of the frame (top) to the location of the frame document...

top.location = self.location;

当然,此代码必须在iframe中执行,并且可以接受同源政策

Of course, this code must be executed within the iframe, and is succeptible to the Same-Origin Policy.

这篇关于window.top.location vs window.location的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆