Re: How to close the Web Browser ?

Discussion in 'ASP .Net' started by Helge Kalnes, Feb 25, 2004.

  1. Helge Kalnes

    Helge Kalnes Guest

    You would need to use a client side script to do that. After the user has
    clicked "Log off", the server could send a page that contains only such a
    script. A very simplified version could look like this:

    <html>
    <head>
    </head>
    <body onload="self.close();">
    You are logged off.
    </body>
    </html>

    or if you prefer:

    <html>
    <head>
    </head>
    <body>
    <script language="javascript">
    self.close();
    </script>
    You are logged off.
    </body>
    </html>

    Note that "self" is a static property of the window class refering to the
    current browser window instance (like the property Current in many .NET
    classes).

    The only problem is that most browsers pops up an OK/Cancel dialog when
    ordered to close, so you might want to put some content into the page as
    well in case the user cancels. An exception to this is when you close a
    modal pop-up dialog page, then you won't get this confirmation.

    Helge

    "Gin Lye" <> wrote in message
    news:...
    > Does any one know to close the web browser automatically after logging

    off.
    >
    > Your help will be appreciated .
    >
    > gin lye
     
    Helge Kalnes, Feb 25, 2004
    #1
    1. Advertising

  2. Additionaly the user may want to use the browser to go to another site after
    logging off (ie closing the browser automatically could be sometimes
    annoying)...

    Patrice

    --

    "Helge Kalnes" <> a écrit dans le message de
    news:OQA82%233%...
    > You would need to use a client side script to do that. After the user has
    > clicked "Log off", the server could send a page that contains only such a
    > script. A very simplified version could look like this:
    >
    > <html>
    > <head>
    > </head>
    > <body onload="self.close();">
    > You are logged off.
    > </body>
    > </html>
    >
    > or if you prefer:
    >
    > <html>
    > <head>
    > </head>
    > <body>
    > <script language="javascript">
    > self.close();
    > </script>
    > You are logged off.
    > </body>
    > </html>
    >
    > Note that "self" is a static property of the window class refering to the
    > current browser window instance (like the property Current in many .NET
    > classes).
    >
    > The only problem is that most browsers pops up an OK/Cancel dialog when
    > ordered to close, so you might want to put some content into the page as
    > well in case the user cancels. An exception to this is when you close a
    > modal pop-up dialog page, then you won't get this confirmation.
    >
    > Helge
    >
    > "Gin Lye" <> wrote in message
    > news:...
    > > Does any one know to close the web browser automatically after logging

    > off.
    > >
    > > Your help will be appreciated .
    > >
    > > gin lye

    >
    >
     
    Patrice Scribe, Feb 25, 2004
    #2
    1. Advertising

  3. Thanks Helge and Patrice.
     
    =?Utf-8?B?R2luIEx5ZQ==?=, Feb 26, 2004
    #3
    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:
    593
    Saravana [MVP]
    Nov 14, 2003
  2. Daniel Albisser
    Replies:
    1
    Views:
    1,130
    GaryM
    Apr 7, 2004
  3. Paul van Rossem
    Replies:
    0
    Views:
    615
    Paul van Rossem
    Apr 7, 2005
  4. Iñaki Baz Castillo
    Replies:
    7
    Views:
    918
    Iñaki Baz Castillo
    Jan 12, 2010
  5. Replies:
    0
    Views:
    527
Loading...

Share This Page