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

Home Posts Topics Members FAQ

How to detect IE window close (X) action by user?



Kumar.A.P.P
Software Engineer, Infosys Technologies Limited.
http://techaid.wordpress.com/
Oct 16 '07 #1
5 2460
"Kumar.A.P.P" <Ku******@discussions.microsoft.comwrote in message
news:86**********************************@microsof t.com...
This question comes up time and time again.

Generally speaking, there is no way for the server to know if the client
browser has been closed, or even if the client has navigated to another
website.

This is because of the fundamental architecture of the web.

The server waits for an incoming HttpRequest.

The server processes the incoming HttpRequest.

The server sends back an HttpResponse.

The server waits for an incoming HttpRequest. If no incoming HttpRequest
arrives, there's nothing the server can do about it...

There have been various possible solutions suggested, mainly to do with the
<body onloadmethod, but none is satisfactory...

Why do you need to know this anyway...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 16 '07 #2
in javascript catch the onbeforeunload or onunload event, and check the
event x & y positions (they will be off srceen). its a hack.

-- bruce (sqlwork.com)
Kumar.A.P.P wrote:
>
Kumar.A.P.P
Software Engineer, Infosys Technologies Limited.
http://techaid.wordpress.com/
Oct 16 '07 #3
As above, catch the body.unload event and fire a postback event from
Javascript to tell the server the page is closing.

The only draw back is that is will fire when the user closes the
browser and when they move to a different page.
Fran

http://www.bluejumper.com

Oct 17 '07 #4
"BlueJumper.com" <fr*******@gmail.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
As above, catch the body.unload event and fire a postback event from
Javascript to tell the server the page is closing.

The only draw back is that is will fire when the user closes the
browser and when they move to a different page.
That's right - so not much use for any website which has more than one
page...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 17 '07 #5
On Oct 17, 9:52 am, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"BlueJumper.com" <fran.h...@gmail.comwrote in message

news:11**********************@i13g2000prf.googlegr oups.com...
As above, catch the body.unload event and fire a postback event from
Javascript to tell the server the page is closing.
The only draw back is that is will fire when the user closes the
browser and when they move to a different page.

That's right - so not much use for any website which has more than one
page...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net

As you so eloquently pointed out, it depends why you need to do this!

Oct 17 '07 #6

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

Similar topics

10
by: RonS | last post by:
Is there a way to close the present (active) window using PHP code?
2
by: Jawahar Rajan | last post by:
All, I have a printer friendly page that is opened when a user clicks a link on my page to get the printer friendly version, How ever when they close out the printer friendly version and return to...
4
by: ...D. | last post by:
OK. I am halfway decent with HTML. Now I want to try javascript for some things that HTML cannot do. I have looked over a tutorial & all. What I want to do is create a button, that when...
18
by: Roger Withnell | last post by:
I open a new window from the current window to display maps. Several maps of different sizes can be displayed. The function is given the size of the map and adjusts the window size accordingly....
5
by: Hemanth | last post by:
Hello there, I'm running a script that opens a popup window (which is basically a form with checkboxes and a submit button). When I click the submit button I want to run a PHP script and target...
3
by: Lord2702 | last post by:
Sat. Oct. 30, 2004 3:25 PM PT I want to detect, if user has close the browser, (after logging to my site), that user has closed the browser. How to achieve it ? I want to know this close action...
8
by: Luke Matuszewski | last post by:
I have read all posts about how to detect that url have changed to new page and trigger the event handler then eg. function aidLogout(evt) { if(evt) { /* maybe via analyse of evt object i can...
5
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.