Welcome to WebmasterWorld Guest from 23.20.120.3

Forum Moderators: open

Message Too Old, No Replies

IE6 quirk: innerHTML w/ any markup breaks Back

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

New User

10+ Year Member

joined:Feb 24, 2006
posts:11
votes: 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!

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 26, 2004
posts:1497
votes: 0


Use DOM methods instead of innerHTML?

gph

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

Full Member

10+ Year Member

joined:Jan 31, 2002
posts:285
votes: 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.
12:27 am on Mar 26, 2006 (gmt 0)

New User

10+ Year Member

joined:Feb 24, 2006
posts:11
votes: 0


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

Thank you for trying! Any other ideas?

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

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 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.
2:01 am on Mar 26, 2006 (gmt 0)

New User

10+ Year Member

joined:Feb 24, 2006
posts:11
votes: 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.

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

New User

10+ Year Member

joined:Feb 24, 2006
posts:11
votes: 0


Any other ideas?
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members