-
Dear all,
I have an html file with two frames. In the first frames document I have a button. I am trying to close the browser window when I ckick on that button. The OnClick event calls a client side function that calls window.close. However it does not work i.e. the window does not get closed. Any ideas/suggestions. Thanks in advance.
-
hi msdn
sorry if this is a stupid question bu have you got the following
window.close();
as If you don't have the brackets, it doesn't cause an error but it also doesn't do anything
Hope this helps
Ian
-
Dear Ian,
Thanks for ur quick fire response. I have got the braces in place i.i window.close(). Even then it does not close the window. Note this happens only if there are multiple frames in the parent document. Any ideas.
-
try the following, I think it will sort out your problem
top.parent.window.close();
-
Chances are tho that it won't close immediately but rather prompt the user asking if they want the window closed.
If this happens then it's because you didn't open the window yourself - you can only close windows that your own script opened in the first place. 'tis a security thingy of java & j script.
(Just a bit o useless info for ya. :))
BTW...if your code still doesn't work then paste it into a reply thread here so we can all see what we're dealing with. :)
-
Dear Matthew,
You r right the window does not close by itself but it asks for a confirmation. Thanks everybody for all your help.