/    Sign up×
Community /Pin to ProfileBookmark

iFrames as Targets

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.

[code=html]<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>[/code]

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

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@donatelloNov 01.2009 — Sounds strange...

Can you use the <BASE> tag to override this?
Copy linkTweet thisAlerts:
@chestertbauthorNov 01.2009 — 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
Copy linkTweet thisAlerts:
@chestertbauthorNov 04.2009 — This issue continues to have me baffled.

Anyone got any more thoughts?
Copy linkTweet thisAlerts:
@chestertbauthorNov 06.2009 — It appears the problem lay in the "Doctype" declaration.

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

Once I switched to
[code=html]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">[/code]
the problem went away.

Thanks to everyone who took the time to give this some thought.

Cheers

CTB
×

Success!

Help @chestertb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...