SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to Close Window using Javascript

    Problem while closing browser window using Javascript....
    For IE we window.close() is working
    But for mozilla firefox browser its not working

    I tried with the following two lines also but still its not closing...,
    netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');
    window.close();

    Please help me on this...

    Thanks & Regards
    Adil.

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You can't close a window if it wasn't opened with window.open() in Mozilla (seems very reasonable to me).

    Why do you want to do this anyway? It's annoying. If the user wants to close the window, let them do it. Pretty much every computer user knows what the little X in the corner is for.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');

    only works for sites where the browser owner allows it to.

    A real world equivalent would be for someone to be able to unlock your front door and enter your house just by saying some magic words rather than having to be given a copy of the key. The magic words would make the key rather useless. Similarly that command would make browser security rather useless if it didn't require the owner's permission which will only ever be given for intranets and never for internet sites.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •