Error sharing IFrame content?

I have a web page with a number of frames, including third-party frames, such as an advertising interface and various sharing buttons.

In Firefox, I noticed that sometimes the contents of these frames are reversed, so you get an ad where another iframe is located. It seems completely random when the iframe content appears. It seems that this may have something to do with caching.

Does anyone know what causes this, or any steps I can take to prevent this from happening?

+4
source share
5 answers

In case someone is looking, I was able to track the error report:

https://bugzilla.mozilla.org/show_bug.cgi?id=356558

It was 4 years old, and it doesn’t even seem like they confirmed it.

+3
source

The workaround described in this Mozilla bug report worked for me:

<iframe src="webpage2.html?var=xxx" id="theframe"></iframe> <script> var _theframe = document.getElementById("theframe"); _theframe.contentWindow.location.href = _theframe.src; </script> 
+3
source

One plausible answer is that two frames have the same name. I survived this several times in conkeror (based on firefox), and each time it was a name conflict.

+1
source

I struggled with this for a while. The problem is firefox and the way to cache iframe content. This is no coincidence. Nothing to do to prevent the use of iframes.

You can reload iframes onload using something like:

 var reloadIframes = function () { var a = window.frames, b = a.length while (b--) { a[b].src = a[b].src; } } 

In the case of advertising, this will lead to double impressions that violate your contract.

An easy way to replicate a problem is to create 3 html files.

 <!--frame1.html--> <html> <body> <h3>frame one</h3> </body> </html> <!--frame2.html--> <html> <body> <h3>frame two</h3> </body> </html> <!--index.html--> <html> <body> <iframe src="frame1.html"></iframe> <iframe src="frame2.html"></iframe> </body> </html> 

Open in firefox. Then switch frame one and two frames.

 <!--index.html--> <html> <body> <iframe src="frame2.html"></iframe> <iframe src="frame1.html"></iframe> </body> </html> 

Update index.html. Frames will not change until you clear the cache.

There is a bug in mozilla, but currently no one is working on it.

0
source

This problem may be similar to yours.

try to put

 window.onload = yourcode; 

along with the unloading of the body.

I have a javascript tool on a segment of the head that contains

 window.onload = initTip; 

but conflict with my onload iframe

 <body onload = "parent.myframe.location='mypage.html'"> 

my solution: remove this window.onload = initTip; from the segment of the head, then place them in the body.

 <body onload = "initTip(); parent.myframe.location='mypage.html'"> 

it works with reload button on firefox

0
source

All Articles