JavaScript - How do you close a child window? - Asked By Burak Gunay on 07-Sep-06 09:23 AM

Hello,

window.opener is used to accesss the parent window from a child window. But I don't know the syntax for accessing the child window from the parent window.

How can you deteremine if  a parent window has a child window and how can you close that window?

Thanks,

Burak




Sushila Patel replied to Burak Gunay on 07-Sep-06 09:27 AM

Check section "Dependent Window" of link

http://www.webreference.com/js/tutorial1/reference.html

Also check

http://codepunk.hardwar.org.uk/bjs09.htm

thanks .. but i am in a content page - Burak Gunay replied to Sushila Patel on 07-Sep-06 09:51 AM

i am in a content page.. how do i write the

<BODY onUnload="closeDep()">
part? I obviously can't write it into the master page.
What can I do?

Closing Child Popup From Parent Browser Window - K Pravin Kumar Reddy replied to Burak Gunay on 07-Sep-06 11:49 AM

hello

check thte code..

<body onUnload="parent.nameOfChildWindow.close();" >

reference link

http://forums.dreamincode.net/showtopic9015.htm

here is the link which tell u all javascript events

just have a look, gud site

http://developer.mozilla.org/en/docs/DOM:window#Event_Handlers

check ... - K Pravin Kumar Reddy replied to Burak Gunay on 07-Sep-06 11:56 AM

hello

u can write that in Masterpage body tag

when ever aspx page is closed it will close popup

or is page lod of aspx

clientScript.registerClientScript(page.Gettype(),"onUnload","javascript:parent.nameOfChildWindow.close();" true),

put this code in pageload...


what can i write into the content page? - Burak Gunay replied to K Pravin Kumar Reddy on 07-Sep-06 12:06 PM
let's say i do not have access to the master page, what cna i write to the content aspx page from the code behind, to get the same effect?
yes gunay - K Pravin Kumar Reddy replied to Burak Gunay on 08-Sep-06 05:36 AM

hello

just try to do that

clientScript.registerClientScript(page.Gettype(),"onUnload","javascript:parent.nameOfChildWindow.close();" true),

put this code in pageload...

it doesn't work - Burak Gunay replied to K Pravin Kumar Reddy on 08-Sep-06 09:09 AM
and the page gives a javascript error when it loads
close a child window in Javascript - J S replied to Burak Gunay on 11-Sep-06 02:47 AM
child.close();
window.child.close();
Hope this works,

charles replied to Burak Gunay on 29-Apr-11 09:01 PM
Also check : http://www.longhowl.com/howls/164