Results 1 to 3 of 3

Thread: closing browser windows

  1. #1
    Join Date
    Sep 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default closing browser windows

    I am trying to design a site that opens a specifically sized window. I have a script in my "index.html" that opens the new window, and everything is good, except I need to also close "index.html" so that it doesn't just sit there in the background. I tried "window.opener.close();", but it doesn't work with Firefox and IE wants to ask if I really want to close the other window. Does anyone know of a better way to close the first window?

  2. #2
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Did you try this yet as a link?
    javascript:window.close()

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Windows not opened via javascript cannot be closed via javascript. This is not some cosmic law but, rather the way security on the web has evolved in most current browsers.

    There is a way around it in IE but, as far as I know, not in any other modern browsers.

    I would question the necessity and wisdom of opening any particularly sized window though. If it is for design purposes, you would be much better off designing your page(s) differently so that they do not depend upon a particularly sized window as, the size you choose will always end up being unsuitable for some users for some reason or another and many browsers (including IE with certain common security settings) will not even allow you to open it in the first place.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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