PDA

Click to See Complete Forum and Search --> : Window closing


msdnexpert
Jan 12th, 2001, 02:22 AM
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.

Ianpbaker
Jan 12th, 2001, 02:41 AM
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

msdnexpert
Jan 12th, 2001, 02:59 AM
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.

Ianpbaker
Jan 12th, 2001, 03:04 AM
try the following, I think it will sort out your problem

top.parent.window.close();

Jan 12th, 2001, 02:27 PM
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. :)

msdnexpert
Jan 14th, 2001, 09:44 PM
Dear Matthew,
You r right the window does not close by itself but it asks for a confirmation. Thanks everybody for all your help.