Forum Moderators: coopster

Message Too Old, No Replies

Breaking out

trapped in an iframe

         

grandpa

4:27 pm on Apr 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I cannot figure this one out. My script is being displayed in an iframe (a wiki page) and I have one option won't give me the correct results unless the page is displayed in either
a) new tab in NS browser
b) new browser instance.

The option in question is used to print forms, and I use the browser Print Preview for the page setup. It's all pretty useless if I have the page and iframe content in my preview.

I thought using header() would do the trick.

Any ideas?

ergophobe

6:28 pm on Apr 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



With regular frames you can use either Javascript or the deprecated target
attribute as in

<a href="mypage.html" target="_top">Show in its own window</a>

If you want to be sure that the page always shows in its own window or you don't want to use a deprecated attribute, you can use some javascript

<script type="text/javascript">
function ownWindow()
{
if (top.location!= location) {
top.location.href = document.location.href ;
}
</script>

<body onload="ownWindow">

Something like that. I'm not really a javascript guy, so you might need to fiddle.

For someone who really knows about javascript, go to quirksmode.org

[quirksmode.org...]

grandpa

2:05 am on Apr 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks ergophone

I guess my brain was "on hold"...

I added a target attribute to the action of my form and it opens a new browser window. Didn't even need js :)