i spent a lot of time yesterday redoing my whole website with iframes for each section but once
i put everything onto the server i found that the links inside the iframes opened inside the iframes rather than in the whole window. how do i escape from the iframe to open a link in the whole window or a new window?
i have just left an example iframe page at http://www.fieryidris.co.uk/iframe.htm so the problem can be seen.

Recommended Answers

All 8 Replies

Research the "target" attribute of hyperlinks.

Should be target="_top"

That's how I fixed my problem like this.

thanks shephunts for target="_top".
i ate some bad fish on saturday and i was already deteriorating when the iframes not doing what i expected finished me off.
i have now done some proper research on the different target commands and checked what happens when you use them in an iframe.

all these links below and the results are within an iframe

<a href="http://www.google.co.uk" target="_blank"> will open google in a new window

<a href="http://www.google.co.uk" target="_parent"> will open google in all of the current window

<a href="http://www.google.co.uk" target="_self"> will open google inside the iframe

<a href="http://www.google.co.uk" target="_top"> will open google in all of the current window

<a href="http://www.google.co.uk"> with no target command will open google inside the iframe

separately from this problem i had of escaping from the iframe i have also been emailed some screenshots by my sister of how the iframe page is being displayed in different browsers and it's not looking very good.
the border of the iframe is only showing on the right hand side and the bottom - i'm not sure if this is because i have got a black background as it seemed to work ok for me in internet explorer and firefox before when the background was red.
in netscape 4.7 the iframe is not displayed at all and the top of the page is just followed by the bottom. i know netscape is now 8.0 so 4.7 is very out of date but is this going to affect any other browsers and destroy the page layout making the iframe a bad idea?


Thanks a lot. This thread helps me much.

Hadn't used IFRAMEs for a while and forgot about having to use _target. Really messed me up!

Useful reminder.

Thanks. its useful to solve my problem also. :)
But instead of click on hyp link i need the same on Image click. Do you have any idea about it.?


<A href="link.htm">Hyper linked Text</a>


<a href="link.htm">
<IMG SRC="yourimage.jpg" border="0">

seem silly but i have done that before, but it didn't work, perhaps because i was making that call from a java scrip, have any body try that, make the same call from a javascript function?

commented: Kind of pointtless responding to a thread from 2008 -1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.