我试图改变javascript变量时,iframing的页面。不一样,但在pinterest上做了一些类似的事情
if (top != self) {
$('body').html('<h1>Unauthorized</h1>')
}
上面是他们的代码。我用这个取消了它
<iframe src="http://www.pinterest.com/?v=
if(top!%3Dself)%7B%24('body').html('%3Ch1%3EUna uthorized%3C%2Fh1%3E')%7D">
这在chrome上是有效的。所以我的问题是,我们可以通过iframe改变javascript变量吗?
发布于 2013-05-26 14:16:09
您可以使用window.parent.document,但要当心跨域操作!有关更多信息,请查看此链接:how to access iFrame parent page using jquery?
https://stackoverflow.com/questions/16760067
复制