Bust out of iframe

B

boyscout

If a link is targeted to an iframe, can the linked page do anything to NOT
appear in the iframe? My efforts to make the linked page pop up a window or
an alert outside of the iframe aren't working.

TIA
 
E

Evertjan.

boyscout wrote on 21 okt 2003 in comp.lang.javascript:
If a link is targeted to an iframe, can the linked page do anything to
NOT appear in the iframe? My efforts to make the linked page pop up a
window or an alert outside of the iframe aren't working.

<a href=".." target="_top">..</a>

or

<script>
top.location.href="..."
 
K

kaeli

boyscout wrote on 21 okt 2003 in comp.lang.javascript:


<a href=".." target="_top">..</a>

or

<script>
top.location.href="..."


Won't that change the page location? Nor sure if the OP wants to
overwrite the page or open a new window...

Try using "_new" in links as the target if you want a brand new window
or using window.open in script.


-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
 
L

Lasse Reichstein Nielsen

boyscout said:
If a link is targeted to an iframe, can the linked page do anything to NOT
appear in the iframe?

No. *After* the page has appeared in the iframe (or at least a little
of it has appeared), it can try breaking out.
My efforts to make the linked page pop up a window or an alert
outside of the iframe aren't working.

I think something else is wrong. Alerts and popups are created by the
browser, and are typically not constrained to the frame that opened
them.

How is it failing? Are you getting any Javascript errors for the code
in the iframe? Are you sure the page is being loaded at all?

/L
 
L

Lasse Reichstein Nielsen

kaeli said:
Try using "_new" in links as the target if you want a brand new window

The string "_new" has no special meaning to browsers. There is no
difference between using "_new", "new" or "arglebargle", it is just
the name of the new window. A second link with the same target will
open in the same window.

To get a new window for every time the link is clicked, use the target
"_blank".

The "special" names are "_blank", "_self", "_top", and "_parent". In
fact, a browser that adheres strictly to the HTML specification must
ignore any other target name starting with an underscore, so the
target name "_new" would be equivalent to no target. Browsers rarely
follow the HTML specification strictly.

or using window.open in script.

The target names for window.open (the second argument) follow the
same rules as HTML target names.

/L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top