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?

33 of 65 people (51%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How to close a window from some other window

Apr 4th, 2008 21:21
ha mo, Colin Fraser, Surendran Subramanian,


While this seems a simple question there is always issues of who is
doing what to whom without paying, or in other words, who is the parent
window and who is the child window, or who is the master now? 
To open a child window try:  
<script language="JavaScript"><!--
msgWindow=open('',window,'resizable=yes,width=200,height=200');
msgWindow.location.href ='nextpage.html';
if (msgWindow.opener == null) msgWindow.opener = self;
//--></script>
This defines the opener, or describes the relationship between the
parent and the child windows. So far this is pretty much standard, in
the child window put:
<script langauge="JavaScript"><!--
opener.close();
//--></script>
This will close the parent window, but will probably cause the close
confirmation prompt before closing the window. 
Good luck.
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