PDA

View Full Version : Make Javascript close window?


freshj
01-22-2005, 06:59 PM
Hey.
I have a javascript link that opens a new window that is a certain size and with no scroll bar or address bar. that all works cool.
But..
I want it to close the original window after youve clicked the link...

so you click the link, the new window opens, and then the window behind it closes...

Anyone know how to do this?

Ive seen it done so I know it is possible


Thankyou allot

Cool-August
01-22-2005, 08:32 PM
Tell us where you saw this, I might be able to go to that site, view it's source and then find the script.;)

freshj
01-22-2005, 08:40 PM
Sorry, no idea where i saw it. it was ages ago

IKLOP
01-22-2005, 08:48 PM
Most browsers won't allow this, and even if they did they would at least give a prompt to make sure it was cool with the user, though I think only old versions of IE do that.

Personally, I wouldn't like it if a site opened up a popup window with no address bar or anything. I wouldn't like it even more if you closed my main window. In my opinion, that wouldn't be a very good design even if it could be done.

chaosyndrome
01-24-2005, 08:27 AM
<a HREF="javascript:window.open('test.html'),window.close(this)">test link</a>


this works, but like IKLOP said, the browser asks the user for a confirmation before closing the window.

Cool-August
01-26-2005, 09:07 PM
It took me a while but I found this also,
You have to put it in the Pop-Up, not the
origanle window.:D

<script type="text/javascript">
self.opener.top.close(true);
</script>