Close browser window.

Discussion in 'ASP General' started by MichaelK, Jan 13, 2006.

  1. MichaelK

    MichaelK Guest

    What's the best way to close current window silently after finished a
    process.
    I'm using the the javascritpt window.close() or top.window.close(), but it
    fires a confirmation window.
    Just want to close it without any confirmation, seems I done it before, but
    can't find where.

    Thanks,
    Michael.
    MichaelK, Jan 13, 2006
    #1
    1. Advertising

  2. This is not an ASP question, since it's all client-side stuff. One of the
    things that may work in browsers today, but shouldn't in the future, is:

    window.opener = window;
    window.close();

    Example:
    <htmL>
    <body>
    <input type="button" onclick="closeIt(false);" value="Close with
    confirmation" />
    <input type="button" onclick="closeIt(true);" value="Close without
    confirmation, probably" />
    <script type="text/javascript">
    function closeIt(b) {
    if(b) { window.opener = window; }
    window.close();
    }
    </script>
    </body>
    </html>

    Ray at home


    "MichaelK" <> wrote in message
    news:...
    > What's the best way to close current window silently after finished a
    > process.
    > I'm using the the javascritpt window.close() or top.window.close(), but it
    > fires a confirmation window.
    > Just want to close it without any confirmation, seems I done it before,
    > but can't find where.
    >
    > Thanks,
    > Michael.
    >
    >
    >
    Ray Costanzo [MVP], Jan 13, 2006
    #2
    1. Advertising

  3. MichaelK

    MichaelK Guest

    Thanks Ray, it's closing window without confirmation, exactly what I was
    looking.

    Well about not an ASP question, it's how to look at it.
    Based on server side process results I generate the page with different
    elements
    and javascritpt modules which will work on the client side.

    Anyway thanks a lot, main thing you helped me.
    Regards, Michael


    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:%...
    > This is not an ASP question, since it's all client-side stuff. One of the
    > things that may work in browsers today, but shouldn't in the future, is:
    >
    > window.opener = window;
    > window.close();
    >
    > Example:
    > <htmL>
    > <body>
    > <input type="button" onclick="closeIt(false);" value="Close with
    > confirmation" />
    > <input type="button" onclick="closeIt(true);" value="Close without
    > confirmation, probably" />
    > <script type="text/javascript">
    > function closeIt(b) {
    > if(b) { window.opener = window; }
    > window.close();
    > }
    > </script>
    > </body>
    > </html>
    >
    > Ray at home
    >
    >
    > "MichaelK" <> wrote in message
    > news:...
    >> What's the best way to close current window silently after finished a
    >> process.
    >> I'm using the the javascritpt window.close() or top.window.close(), but
    >> it fires a confirmation window.
    >> Just want to close it without any confirmation, seems I done it before,
    >> but can't find where.
    >>
    >> Thanks,
    >> Michael.
    >>
    >>
    >>

    >
    >
    MichaelK, Jan 13, 2006
    #3
  4. I understand what you're saying about the asp vs. javascript thing. It's
    mostly for your benefit to post in the correct group though. While there
    are many ASP experts floating around here, it's not uncommon for those
    people to struggle with basic javascript, so you never know what you'll get
    when you're in the wrong group.

    Ray at home

    "MichaelK" <> wrote in message
    news:%23q1jY$...
    > Thanks Ray, it's closing window without confirmation, exactly what I was
    > looking.
    >
    > Well about not an ASP question, it's how to look at it.
    > Based on server side process results I generate the page with different
    > elements
    > and javascritpt modules which will work on the client side.
    >
    > Anyway thanks a lot, main thing you helped me.
    > Regards, Michael
    >
    >
    > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    > message news:%...
    Ray Costanzo [MVP], Jan 13, 2006
    #4
  5. MichaelK

    MichaelK Guest

    Well, I would probably do, just didn't find any good organized javascript
    groups.
    Have you seen any good ones by chance?

    Michael.

    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:%234CHsM%...
    >I understand what you're saying about the asp vs. javascript thing. It's
    >mostly for your benefit to post in the correct group though. While there
    >are many ASP experts floating around here, it's not uncommon for those
    >people to struggle with basic javascript, so you never know what you'll get
    >when you're in the wrong group.
    >
    > Ray at home
    >
    > "MichaelK" <> wrote in message
    > news:%23q1jY$...
    >> Thanks Ray, it's closing window without confirmation, exactly what I was
    >> looking.
    >>
    >> Well about not an ASP question, it's how to look at it.
    >> Based on server side process results I generate the page with different
    >> elements
    >> and javascritpt modules which will work on the client side.
    >>
    >> Anyway thanks a lot, main thing you helped me.
    >> Regards, Michael
    >>
    >>
    >> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    >> message news:%...

    >
    >
    MichaelK, Jan 13, 2006
    #5
  6. The one on the MS server isn't bad, it's microsoft.public.scripting.jscript.
    But I believe that comp.lang.javascript is a very popular one.

    Ray at home


    "MichaelK" <> wrote in message
    news:%...
    > Well, I would probably do, just didn't find any good organized javascript
    > groups.
    > Have you seen any good ones by chance?
    >
    Ray Costanzo [MVP], Jan 13, 2006
    #6
  7. MichaelK wrote:
    > Thanks Ray, it's closing window without confirmation, exactly what I
    > was looking.
    >
    > Well about not an ASP question, it's how to look at it.


    Just to add to what Ray said:

    If what you are asking about could be applied to a .htm file, then you are
    not asking about ASP.

    It is to everyone's benefit to keep these newsgroups focussed.

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Jan 13, 2006
    #7
  8. MichaelK

    Larry Bud Guest

    MichaelK wrote:
    > Well, I would probably do, just didn't find any good organized javascript
    > groups.
    > Have you seen any good ones by chance?


    The one you want is

    comp.lang.javascript
    Larry Bud, Jan 13, 2006
    #8
    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. Denon
    Replies:
    1
    Views:
    560
    Saravana [MVP]
    Nov 14, 2003
  2. Replies:
    6
    Views:
    8,796
    sateeshranga
    Aug 7, 2008
  3. Iñaki Baz Castillo
    Replies:
    7
    Views:
    820
    Iñaki Baz Castillo
    Jan 12, 2010
  4. Shang Wenbin

    close current window using window.close()

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

Share This Page