Hi arun,
..depends on the browser(version).
Microsoft has put many new exiting features in their MS IE 5+ browsers, one
of this
features is an event that is triggered "just before" a browser is closed -
this event
you can hook up to and then close the child! :-)
For instance:
var objChildHandler = ''; // Global window handler
function closeMyChild() {
objChildHandler.close();
}
window.onbeforeunload=closeMyChild
Microsoft writes that to invoke this event you can:
* Close the current browser window.
* Navigate to another location by entering a new address or selecting
a Favorite.
* Click the Back, Forward, Refresh, or Home button.
* Click on an a that refers the browser to another Web page.
* Invoke the a click method.
* Invoke the document write method.
* Invoke the document open method.
* Invoke the document close method.
* Invoke the window close method.
* Invoke the window open method, providing the possible value _self
for the window name.
* Invoke the window navigate or NavigateAndFind method.
* Invoke the location replace method.
* Invoke the location reload method.
* Specify a new value for the location href property.
* Submit a form to the address specified in the action attribute via
the input type=submit control, or invoke the form submit method.
Cheers,
Sten Hougaard
EDB Gruppen
Application developer/web-designer
> Hi,
>
> Thanks for the code Sten.
>
> From a parent window i am opening the chlid window, if the user closes
the
> parent window before the child is closed it gives an error message when
> operating in it as it calls the parent.
> Is there a way to close the child window when the parent window is
closed?
>
> regards
> arun