假设有三个页面 http://a.com/a.html
,http://b.com/b.html
,http://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;