开发者

chrome unable to get top.document after changing url

开发者 https://www.devze.com 2023-03-31 18:59 出处:网络
I am not using any plugins or frameworks. I have some local help pages (which will not be hosted on a server), most of which need to be loaded into a frame.So, duringonload, I check if the page is in

I am not using any plugins or frameworks.

I have some local help pages (which will not be hosted on a server), most of which need to be loaded into a frame. So, duringonload, I check if the page is in a frame or not:

top.document.location.href == document.location.href

and if this is true, and therefore the page is not in a frame, then I

top.document.location.href = "frame.html?info="+document.location.href;

Now, when frame.html?info=stuff.html loads, I can get the info parameter from:

`top.document` or `window.top.document`

and load that page into a frame as intended.

This all works as in开发者_如何学Ctended on Safari, IE9, and Opera. It does not work in Chrome. Instead, top.document and window.top.document are both undefined after frame.html is loaded.

How should I get the top URL and, more importantly, its parameters when I load frame.html?info=...

If it is helpful, I believe this behavior is because of this issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消