Results 1 to 6 of 6

Thread: Window closing

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    266
    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.

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    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
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    266
    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.

  4. #4
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    try the following, I think it will sort out your problem

    top.parent.window.close();
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  5. #5
    Guest
    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.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    266
    Dear Matthew,
    You r right the window does not close by itself but it asks for a confirmation. Thanks everybody for all your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width