可能重复: 我怎样才能得到iframe的当前位置?
嗨,
如何在我的iFrame中获取页面的URL。
举个例子,我的页面上有一个ifarme:
<IFRAME name="Google" id="Google" style="position:absolute;left:0px;top:100px;width:500px;height:500px;z-index:1" src="http://www.google.com/" frameborder="1"></IFRAME>如果页面在iframe内部发生变化,就像如果http://www.google.com更改一样,那么它应该会给出批准的Url。
我试过使用document.getElementById("Google").contentWindow,,但它提供了“拒绝访问”错误。知道该怎么做吗?
提前谢谢。你好,巴斯卡迪普·卡因德
发布于 2009-06-08 19:00:09
复制:https://stackoverflow.com/questions/44359/how-do-i-get-the-current-location-of-an-iframe,这里有几个如何使用伊夫拉梅的教程。
发布于 2009-06-08 19:00:56
我认为在这里使用getElementById是不对的。检查这是否有用:
var foo=document.getElementsByTagName("iframe");
alert(foo[0].src);https://stackoverflow.com/questions/966350
复制相似问题