homepage Welcome to WebmasterWorld Guest from 54.161.202.234
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
IE6 quirk: innerHTML w/ any markup breaks Back
pcdivenii




msg:1477025
 2:53 am on Mar 25, 2006 (gmt 0)

I found out in IE6 that when a visitor leaves and then returns to a page that contains an iframe... the last-loaded page within that iframe will load ONLY if the innerHTML of an object is NOT set with HTML tag(s) included. If the innerHTML contains a tag, such as "<b>" or "<someFakeTag>", the first-loaded page within that iframe will (unfortunately for me) load instead.

Example:

1.html:
<div id=nfo>&nbsp;</div>
<iframe name=t2f src="2.html" frameborder=10></iframe>

2.html:
<a href="3.html" target="_self">3.html</a>

3.html:
<script>parent.document.getElementById('nfo').innerHTML='<b>Test</b>';</script>
<a href="http://www.cnn.com/" target="_top">CNN</a>

The visitor loads "1.html" ("2.html" is in 1.html's iframe) and then clicks the "3.html" link.

"3.html" sets the innerHTML of 1.html's div to something WITH an HTML tag in it ("<b>").

The visitor cliks the CNN link and goes to CNN.com, then hits the back button. UNFORTUNATELY: 2.html loads within the iframe instead of 3.html (the last-used page).

If we were to get rid of that "<b>" tag in 3.html's innerHTML like:
<script>parent.document.getElementById('nfo').innerHTML='Test';</script>
<a href="http://www.cnn.com/" target="_top">CNN</a>
, then 3.html (the last-used page would load... as it should.

I need tags within that innerHTML but I also need the last-used page in the iframe to load when a user navigates back to my page.

This is a problem only in IE6 for me. Firefox navigates just properly when HTML tags are within the innerHTML.

Any ideas to overcome this issue?

Thank you!

 

Robin_reala




msg:1477026
 3:44 pm on Mar 25, 2006 (gmt 0)

Use DOM methods instead of innerHTML?

gph




msg:1477027
 4:25 pm on Mar 25, 2006 (gmt 0)

I tried this a few ways, a function in the parent, using DOM etc. Nothing worked. It is strange behaviour and I unfortunately don't have an answer for you.

pcdivenii




msg:1477028
 12:27 am on Mar 26, 2006 (gmt 0)

The DOM method didn't even work!? Uhg...

Thank you for trying! Any other ideas?

DrDoc




msg:1477029
 12:35 am on Mar 26, 2006 (gmt 0)

As far as I know, no browsers keep the scripting state. It will go back to whatever the page looked like when you first visited it.

pcdivenii




msg:1477030
 2:01 am on Mar 26, 2006 (gmt 0)

The latest Firefox, Mozilla, Netscape and Opera keep the last-loaded frame page when returning back to a website in the above scenario.

IE also does this successfully except in the above scenario.

pcdivenii




msg:1477031
 12:19 pm on Mar 30, 2006 (gmt 0)

Any other ideas?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved