首页 > 使用iframe跨域的情况下如何获得父页面URL

使用iframe跨域的情况下如何获得父页面URL

假设有三个页面 http://a.com/a.htmlhttp://b.com/b.htmlhttp://c.com/c.html,通过iframe,a嵌套b,b嵌套c,请问如何在c.html中通过JS获得a.html的URL。

唯一能控制的只有c.html中的代码。


通过document.referrer


window.parent返回父窗口 window.top返回顶级窗口 然后用location.href获取

比如window.top.location.href;

【热门文章】
【热门文章】