solution to display bugs in IFrame when Firefox returns _ Experience Exchange
<script type= "Text/javascript" >//<! [Cdata[if (GetCookie (' Firefoxiframe ')) {document.write (' <p id= ' Addad "><a href=" cookie.html "> Click here to delete this iframe</a></p> '); document.write (' <iframe height= ' "width=" marginheight= "0" marginwidth= "0" frameborder= "0" src= "nAdPre.swf "></iframe>");} else{document.write (' <p id= ' Addad "><a href=" cookie.html "> click here to add a iframe</a></p> ');}//]] ></script>
Open the bug demonstration, because the cookie does not exist, the display of three Flash is implemented through the IFRAME
Click "Click here to add an iframe ad", Jump to a new page to write a cookie named Firefoxiframe
Click "Back" or the return button of the browser, back to the Bug demo page, found inside the IFRAME flash dislocation, that is, the location 2 of the IFRAME link Flash is not loaded, showing the location of 3 flash, position 3 of the display is the location of the 4 flash, The location 4 flash still exists.
Close the tab (not close the entire browser, if the entire browser is turned off the cookie also expires) or a new tab to reload the page, 4 iframe normal display 4 flash
At this time if you click "Click here to delete this iframe ads", Jump to New page Delete cookie, return also found in the IFRAME flash dislocation
If you write a cookie or delete a cookie, not through the browser's return, directly through the URL access, there will be no dislocation
simple analysis and Solution
It seems that when Firefox returns, JavaScript is re-executed, but the IFRAME is not re-loaded according to the SRC attribute, but instead is paired with a similar number to the IFRAME and SRC, and because the JavaScript is executed when it returns, Causes an IFRAME to be one (or one less), which results in a mismatch in the back.
above is guessing only, But this is really a bug,ie of Firefox (2.0.0.3) when the JavaScript is re-executed, and the IFRAME is re-loaded by SRC, and when opera returns, JavaScript does not re-execute and the page does not change. The
solution is to add a hidden iframe to the text, and the code above modifies the following code:
document.write (' <p id= "Addad" ><a href= "cookie.html" > click here to add a iframe</a></p> '); Modify the above code to become document.write (' <iframe src= ' # "style=" Display:none; " ></iframe> '); document.write (' <p id= "Addad" ><a href= "cookie.html" > click here to add a iframe</a></p> ');
The above is the Firefox return when the IFRAME display bug Solution _ Experience Exchange content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!