Close Window + Netscape7

Discussion in 'Javascript' started by Asit, Sep 2, 2004.

  1. Asit

    Asit Guest

    <META HTTP-EQUIV="expires" content="0">
    <META HTTP-EQUIV="pragma" content="no-cache">
    <html>
    <head>
    <title>Fidelity NetBenefits</title>
    </head>
    <body BGCOLOR="#ffffff">

    <script LANGUAGE="JavaScript">

    function NoFramesAllowed() {
    if (this.top != this) {
    top.location.href=this.location.href;
    return;
    }
    }

    function CloseWindow()
    {
    if (window.name != "")
    window.name = "";
    window.close();
    }


    </script>

    <center>
    <table WIDTH="620" CELLPADDING="0" CELLSPACING="0" BORDER="0">



    <tr><td></td><td COLSPAN="2"></td>
    <td ALIGN="LEFT">
    <form>
    <input TYPE="BUTTON" onClick="CloseWindow()" VALUE="Click Here to
    Close Your Browser">
    </td>
    </form>
    </tr>
    </table>

    </center>
    </body>
    </html>

    Save this as close.html

    Open your Netscape 7 browser and then open this html file and click on
    close button, it will not close the browser in Netscape but working
    with Internet Explorer.

    My Question is if the window is not being opened by the javascript,
    then how to close the window by the Netscape ?

    Is there any solution to this ?

    Any help is appreciated.

    Regards
    Asit
     
    Asit, Sep 2, 2004
    #1
    1. Advertising

  2. Asit wrote:

    > function CloseWindow()
    > {
    > if (window.name != "")
    > window.name = "";
    > window.close();
    > }
    >


    > <input TYPE="BUTTON" onClick="CloseWindow()" VALUE="Click Here to
    > Close Your Browser">


    > Open your Netscape 7 browser and then open this html file and click on
    > close button, it will not close the browser in Netscape but working
    > with Internet Explorer.
    >
    > My Question is if the window is not being opened by the javascript,
    > then how to close the window by the Netscape ?


    Check your Netscape 7 JavaScript console, it will probably show you a
    message that script tried to close a window that it is not allowed to close.
    As far as I know there is nothing you can do about that, with Netscape 4
    you could use signed script to request the privilege to close the window
    but that doesn't seem to be supported by Netscape 7.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Sep 2, 2004
    #2
    1. Advertising

  3. Asit

    Lee Guest

    Asit said:

    >function CloseWindow()
    >{
    > if (window.name != "")
    > window.name = "";
    > window.close();
    >}


    >Open your Netscape 7 browser and then open this html file and click on
    >close button, it will not close the browser in Netscape but working
    >with Internet Explorer.
    >
    >My Question is if the window is not being opened by the javascript,
    >then how to close the window by the Netscape ?


    This only works in Internet Explorer because of a bug.
    You are not supposed to be able to close a window that
    you didn't open with script.

    The user certainly knows how to close his browser.
     
    Lee, Sep 2, 2004
    #3
  4. Asit

    DU Guest

    Lee wrote:

    > Asit said:
    >
    >
    >>function CloseWindow()
    >>{
    >> if (window.name != "")
    >> window.name = "";
    >> window.close();
    >>}

    >
    >
    >>Open your Netscape 7 browser and then open this html file and click on
    >>close button, it will not close the browser in Netscape but working
    >>with Internet Explorer.
    >>
    >>My Question is if the window is not being opened by the javascript,
    >>then how to close the window by the Netscape ?

    >
    >
    > This only works in Internet Explorer because of a bug.


    Correct.

    > You are not supposed to be able to close a window that
    > you didn't open with script.
    >


    Correct. That's what MSDN says too. And even if a window was opened by
    javascript, an user should be able to refuse that a script can close at
    will the window (just as much as user setting, popup blocking software
    can prevent scripts from opening new windows at will).

    NS 7.2 and Mozilla-based browsers have
    dom.allow_scripts_to_close_windows user pref setting which is entirely
    under the control of users.

    > The user certainly knows how to close his browser.
    >


    DU
    --
    The site said to use Internet Explorer 5 or better... so I switched to
    Netscape 7.2 :)
     
    DU, Sep 2, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Latter
    Replies:
    10
    Views:
    887
    John Latter
    Sep 24, 2003
  2. Iñaki Baz Castillo
    Replies:
    7
    Views:
    874
    Iñaki Baz Castillo
    Jan 12, 2010
  3. Dade Murphy

    Mouseposition in Netscape7

    Dade Murphy, Jan 19, 2004, in forum: Javascript
    Replies:
    3
    Views:
    83
    Richard Cornford
    Jan 20, 2004
  4. Lynn
    Replies:
    3
    Views:
    167
    Dr John Stockton
    Sep 15, 2004
  5. Shang Wenbin

    close current window using window.close()

    Shang Wenbin, Sep 1, 2005, in forum: Javascript
    Replies:
    10
    Views:
    382
    Gérard Talbot
    Sep 2, 2005
Loading...

Share This Page