473,466 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to close the Web Browser ?

Does any one know to close the web browser automatically after logging off

Your help will be appreciated

gin lye
Nov 18 '05 #1
3 1806
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" <an*******@discussions.microsoft.com> wrote in message
news:2D**********************************@microsof t.com...
Does any one know to close the web browser automatically after logging off.
Your help will be appreciated .

gin lye

Nov 18 '05 #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" <he**********@electricfarm.no> a écrit dans le message de
news:OQ******************@tk2msftngp13.phx.gbl...
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" <an*******@discussions.microsoft.com> wrote in message
news:2D**********************************@microsof t.com...
Does any one know to close the web browser automatically after logging

off.

Your help will be appreciated .

gin lye



Nov 18 '05 #3
Thanks Helge and Patrice.
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk...
6
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This...
3
by: Denon | last post by:
How to trap browser close event in SERVER side? I read a lot of forum message, it talk about onclose(), onunload() and even onbeforeunload() event. However, all of theses are based on javascript...
4
by: Ron Lautmann | last post by:
I want to close a browser window so I created a Close button that does this: private void Button1_Click(object sender, System.EventArgs e) {...
7
by: Paul | last post by:
Hi I have a web application that has a log off selection, just redirects the browser to a form with a label displaying you are loging off. In part of the application I open a new window and was...
5
by: Randy | last post by:
Hello, I'm trying to find a way to close the browser with out the IE security message "The Web page you are viewing is trying to close the window." message. I know how to close the browser using...
37
by: Jan Tovgaard | last post by:
Hey everyone:) We have a critical problem, which I can see that other people also has ran into. In Internet Explorer 7 it is no longer possible to do a window.close after opening a window,...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
5
by: jimmy | last post by:
Hi all, I want to capture the event when the browser's close button is clicked in an html page. I tried using the event.ClientX and event.ClientY property in the body unload event, and this...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.