开发者

Firefox strange iframe behavior

I have a site that normally embeds all content in an iframe. If you were to try to access the same content directly through the browser, we load the site framework and instead load that content in the ifram开发者_运维百科e for you (this is all handled by referer determining if it's an internal or external request).

This works just fine in Google Chrome, but Firefox seems to refuse to request content in an iframe if it's the same as the parent window URL. Is this expected? I could imagine them doing this to prevent infinite loops, but I can't find it documented anywhere. The strange part is I can work around it by adding anything additional to the query string. Of course, I'd prefer not to have to do this.

And if this is expected behavior, is what I'm doing not such a good idea?


Using iFrames is in general not the hottest plan, but it may be justified. Firefox's behavior is to be expected, however. Your two options are:

1) When you detect a user loading an inner frame alone, redirect (via HTTP-HEADER) to the parent page and use a query string to tell that page what inner frame to load.

2) Do what you're doing now, and add a query string full of random data (&framebuster=231784783243253426543) to keep things nice and separate.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜