Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: How to close the Web Browser ?

Reply
Thread Tools

Re: How to close the Web Browser ?

 
 
Helge Kalnes
Guest
Posts: n/a
 
      02-25-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Does any one know to close the web browser automatically after logging

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



 
Reply With Quote
 
 
 
 
Patrice Scribe
Guest
Posts: n/a
 
      02-25-2004
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" <(E-Mail Removed)> a écrit dans le message de
news:OQA82%233%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Does any one know to close the web browser automatically after logging

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

>
>


 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2luIEx5ZQ==?=
Guest
Posts: n/a
 
      02-26-2004
Thanks Helge and Patrice.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close a TCP socket? (TCPSocket#close doesn't close it) Iñaki Baz Castillo Ruby 7 01-12-2010 01:32 PM
Browser close event (MSIE and FF): how to detect browser close ? pamelafluente@libero.it Javascript 0 01-23-2007 12:44 AM
Why does JdbcRowSetImpl.close() close the database connection? Paul van Rossem Java 0 04-07-2005 07:01 PM
JavaMail POP3 folder.close() method close also store! Daniel Albisser Java 1 04-07-2004 03:45 PM
How to close child browser while parent close? Denon ASP .Net 1 11-14-2003 08:14 AM



Advertisments