Faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 39 people (33%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How do i auto close the old window when i open a new one???

Apr 7th, 2008 22:44
ha mo, Dave Clark, Sergio Beristain, Uros Marolt,


You can only do this if you open the window with the one that you are 
closing. 
<a href="javascript: window.open(myURL);window.close()">Open and close 
window</a>
The main problem is that every page gets a name when it is opened and 
using this name you can close windows. So you can only close windows 
that you have opened.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     Similar to what has already been said, you can do the following 
(from the child or new window) but if the parent window was not 
created by JavaScript then, for security reasons, the user will be 
prompted to authorize this action:
top.opener.top.close();
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com