Click to See Complete Forum and Search --> : iFrames as Targets


chestertb
11-01-2009, 06:47 AM
Hi All,

I'm having difficulty with iframes as targets for page loads.

When my top page opens, it creates a menu, and an iframe into which items on the menu will load.

Each time the top page loads, the iframe is given a unique name, so that multiple instances of the top page can exist within the browser, each with it's own iframe.

<div id='m11' style='display:block'>
<a href='/admin/adm10.php' target='content856705' ><img src='/menu-users.jpg' title='Control Panel' border='0'></a>
<a href='/admin/adm03.php' target='content856705' ><img src='/menu-password.jpg'title='Password' border='0'></a>
<a href='/admin/adm09.php' target='content856705' ><img src='/menu-history.jpg' title='History' border='0'></a>
</div>
You can see that in the above example, the iframe is called 'content856705', being 'content' plus a random 6 digit number.
The problem has me baffled...
When the user clicks on, say, Password, the password page opens within the iframe as intended. The user changes the password, and submits the form. Note that there is no target in the form (the default should be '_self').
The user then clicks, say, History, and the browser opens the target script in a new window (or tab) instead of the target iframe. Remember that the name of the iframe and the top page haven't changed, so the target reference should still be valid. All that has happened is that the user have submitted a form within the iframe.
This happens in IE8, Chrome and Safari, but not Firefox.
Any thoughts?
CTB

donatello
11-01-2009, 07:16 AM
Sounds strange...

Can you use the <BASE> tag to override this?

chestertb
11-01-2009, 07:55 AM
Thanks Donatello,
Yeah, "strange" is one of the milder words I've used.
I tried base... same result (but nice thought though).
I also tried putting target='_self' in the form that opens in the iframe.
ANd finally, I tried passing the iframe's name to the script that opens in the iframe, and setting the target to that name. Same result.
It's a mystery.
CTB

chestertb
11-04-2009, 04:10 PM
This issue continues to have me baffled.
Anyone got any more thoughts?

chestertb
11-05-2009, 06:59 PM
It appears the problem lay in the "Doctype" declaration.

I was using "Transitional" with "loose.dtd".

Once I switched to
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
the problem went away.
Thanks to everyone who took the time to give this some thought.
Cheers
CTB