Page 1 of 1

Disabling "opening in a new windows" - Possible?

Posted: Mon Aug 22, 2005 1:32 pm
by pilau
Is it possible?
Or maybe it's possible to check (after the page has loaded) if it was opened in a new window - and then to do something like redirecting to a page, or to close the window using a javascript function.
Can I check this thing when a user loads a webpage?

Posted: Mon Aug 22, 2005 1:36 pm
by feyd
you can make it challenging, but impossible? not really. If they can find out the URL, which has to be possible, then they can open it in a new window. Whether the page lets them is another story, but unfortunately, that depends on Javascript.

check the cleint side board for various things, like the checking if in a frame code (page 2 right now, I think) and such...

At any rate, this is being moved to Client Side.

Posted: Mon Aug 22, 2005 1:40 pm
by pilau
Great, thanks a lot feyd.
I was talking about what you said exactly - that the page itself will prevent the surfers to see the page if it was opened from a new window.

Posted: Tue Aug 23, 2005 5:14 am
by raghavan20
if a page is opened in a new window will it have the history object with itself??? :roll:

Posted: Tue Aug 23, 2005 7:09 am
by feyd
raghavan20 wrote:if a page is opened in a new window will it have the history object with itself??? :roll:
very often, no.

Posted: Tue Aug 23, 2005 8:21 am
by patrikG

Code: Select all

<script language='Javascript'>
if(opener.location && opener.location!=self.location){ 
     opener.location=self.location;
     self.close();
}
</script>
Probably not 100% reliable though (JS needs to be enabled, maybe even browser-issues etc.)