Results 1 to 4 of 4

Thread: window.close() query

  1. #1

    Thread Starter
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158

    window.close() query

    Here is what I'm doing,

    1. Someone comes to my site, it says click her to lauch site

    2. Site launches in a new window (600 x 400), centered on the screen

    3. When the user clicked 'launch site' it also contained JavaScript to close that window.

    Now the problem is when the window is being closed I get a prompt saying somthing like the web page is trying to close the window, do you want to close the window.

    I want to close the window without the prompt comming up, I have seen other sites do it and it works, but when I write the same line I get a prompt ?

    Is it due to some setting in my browser or somthing ?

    Can some one show me (with JS code) how I can close the window without the prompt appearing.

    !!! Thank You In Advance !!!

  2. #2
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    I don't know if there's a way around it, but I think it's a security feature of IE to try to prevent malicious scripts. If you try it in NS or Opera it shouldn't prompt you. If the window has no history (i.e. back and forward disabled), or it was opened using JS, I think you should not get the prompt.

  3. #3
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    top.window.close();

    -Matt
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  4. #4
    scoutt
    Guest
    put it this way. you cannot close any window you didn't open with javascript. sure you can close it but that message will show up. no way around it. I also think it does it in other browsers as well.

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