473,224 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Tracking users when browser is closing

Hi all,

I have an important question to ask about how to trap events when the user
close the browser window.
I'm a ASP programmer and I have s MSSQL database with a user table where I'm able to track if the user is logged in or not.
However this is not easy to track if the user close the browserwindow without using the logout button. I have tried putting in code in Session_onend, but it doesn't seem to run if the browser is closed. Eg. tracking visitors in a application variable in Session_OnStart and Session_OnEnd.
So if there is any solutions on a safe way on logging users in a database, please let me know!
In advance thank you very much!!

Kind regards,

Jon Haakon

--
------------------------------
Jon Haakon Ariansen
System Consultant
Jul 19 '05 #1
11 3406
use an html onclose event to launch another page that will briefly pop-up,
make the necessary tweaks to your data and them close itself... of course
this is defeated if they have a pop-up killr but you are no further back.

"hawkon" <ha****@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
Hi all,

I have an important question to ask about how to trap events when the user
close the browser window.
I'm a ASP programmer and I have s MSSQL database with a user table where I'm able to track if the user is logged in or not. However this is not easy to track if the user close the browserwindow without using the logout button. I have tried putting in code in
Session_onend, but it doesn't seem to run if the browser is closed. Eg.
tracking visitors in a application variable in Session_OnStart and
Session_OnEnd. So if there is any solutions on a safe way on logging users in a database, please let me know! In advance thank you very much!!

Kind regards,

Jon Haakon

--
------------------------------
Jon Haakon Ariansen
System Consultant

Jul 19 '05 #2
hawkon wrote:
Hi all,

I have an important question to ask about how to trap events when the
user
close the browser window.
I'm a ASP programmer and I have s MSSQL database with a user table
where I'm able to track if the user is logged in or not.
However this is not easy to track if the user close the browserwindow
without using the logout button. I have tried putting in code in
Session_onend, but it doesn't seem to run if the browser is closed.
Eg. tracking visitors in a application variable in Session_OnStart
and Session_OnEnd. So if there is any solutions on a safe way on
logging users in a database, please let me know!
In advance thank you very much!!

Kind regards,

Jon Haakon


It is unlikely that you will get much help with client-side code and events
in an asp group (asp is server-side technology). While many here do have
knowledge about client-side code, they are unlikely to answer such questions
here because their desire is to come to this group to discuss asp. You will
have better success getting a helpful response on one of the dhtml or
scripting newsgroups.

That said, the closing of the browser window does not raise any trappable
events. The window_onclose event does not fire when the browser is closed.

Sorry.
Aaron has an article on his site about tracking database use that you may
find helpful: http://www.aspfaq.com/show.asp?id=2491

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3
Sounds very nice - however I've been looking for html close event without any luck.
So my question would be - what kind of close event can I use that is supported by the main browsers like MSIE, Netscape and Opera??

In advance thank you very much!

Kind regards,

Jon Haakon
--
------------------------------
Jon Haakon Ariansen
System Consultant
"UncleWobbly" wrote:
use an html onclose event to launch another page that will briefly pop-up,
make the necessary tweaks to your data and them close itself... of course
this is defeated if they have a pop-up killr but you are no further back.

"hawkon" <ha****@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
Hi all,

I have an important question to ask about how to trap events when the user
close the browser window.
I'm a ASP programmer and I have s MSSQL database with a user table where

I'm able to track if the user is logged in or not.
However this is not easy to track if the user close the browserwindow

without using the logout button. I have tried putting in code in
Session_onend, but it doesn't seem to run if the browser is closed. Eg.
tracking visitors in a application variable in Session_OnStart and
Session_OnEnd.
So if there is any solutions on a safe way on logging users in a database,

please let me know!
In advance thank you very much!!

Kind regards,

Jon Haakon

--
------------------------------
Jon Haakon Ariansen
System Consultant


Jul 19 '05 #4
Hi,

Sounds very nice - however I've been looking for html close event without any luck.


No really an html event, but rather a Javascript event.

<body onClose="do_your_thing()">

Yan

Jul 19 '05 #5
Yan Roosens wrote:
Hi,

Sounds very nice - however I've been looking for html close event
without any luck.
No really an html event, but rather a Javascript event.

Just to be picky, it's not a Javascript event. It's a DOM event. Document
Object Model. Totally separate from Javascript, although it is usable by
Javascript as well as vbscript.

<body onClose="do_your_thing()">

I've found this to be unreliable when attempting to catch browser closes.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #6
Jon,

I am having that exact same issue. I am desperately trying to figure it out, as this problem is causing a delay in the development of the project I am working on. If you (or anyone else for that matter) find a solution, please don't hesitate to email it to me. Likewise, should I solve this dilemma, I will post it immediately as well as email it to everyone in this thread that has a readable email address.

Thanks in advance,
--------------------------
Rob Davidson
Software Engineer
PacificTec, Inc.
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Jul 19 '05 #7
There is no solution. You simply can not do it. That is why a stateless "web
application" is not the proper solution for every situation.

--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com

"Robert Davidson" <ro***@pacifictec.com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
Jon,

I am having that exact same issue. I am desperately trying to figure it out, as this problem is causing a delay in the development of the project I
am working on. If you (or anyone else for that matter) find a solution,
please don't hesitate to email it to me. Likewise, should I solve this
dilemma, I will post it immediately as well as email it to everyone in this
thread that has a readable email address.
Thanks in advance,
--------------------------
Rob Davidson
Software Engineer
PacificTec, Inc.
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &

ASP.NET resources...
Jul 19 '05 #8
I just finished up a feature like this on my community website. My
solution was to use an IFrame with an ASP page that I called
WhosOnline.asp. This is a self refreshing page that refreshes every 30
seconds.

The page executes a stored procedure on SQL Server that modifies and
reads a table called WHOS_ONLINE_T. This table only has two fields
(member_id and date_visited). Basically what the procedure does is
deletes any records in which the date visited is older than 35 seconds,
plugs in the members id and date visited (or updates the record if the
member is already present in the table with the current date/time). Then
the proc returns all records from the table.

It works beautifully and as a result the data in the table is only 30
seconds stale at most. Not bad for given that we are in a stateless
environment.

If you are interested, email me and I can give you the specs. It tooke
me less than an hour to completely code.

Alex Kail

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #9
"Alex Kail" <ka***@hotmail.com> wrote in message
news:eU*************@TK2MSFTNGP12.phx.gbl...
| I just finished up a feature like this on my community website. My
| solution was to use an IFrame with an ASP page that I called
| WhosOnline.asp. This is a self refreshing page that refreshes every 30
| seconds.
|
| The page executes a stored procedure on SQL Server that modifies and
| reads a table called WHOS_ONLINE_T. This table only has two fields
| (member_id and date_visited). Basically what the procedure does is
| deletes any records in which the date visited is older than 35 seconds,
| plugs in the members id and date visited (or updates the record if the
| member is already present in the table with the current date/time). Then
| the proc returns all records from the table.
|
| It works beautifully and as a result the data in the table is only 30
| seconds stale at most. Not bad for given that we are in a stateless
| environment.
|
| If you are interested, email me and I can give you the specs. It tooke
| me less than an hour to completely code.
|
| Alex Kail
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!

This sounds like a very good piece of code, but how compatible is it? Does
it work with browsers like firefox / mozilla / opera / crazy browser /
netscape / WebTV. I don't want to start a flame war, but isn't the whole
point behind development to be able to reach as many clients as possible? I
know quite a while ago iFrame was limited to IE only, so my question is,
would it be an acurate measurement tool if you have users using these other
browsers? Most of my sites are does not limit what browser can be used, and
it would be nice to know your code is compatible :)

--
Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
Jul 19 '05 #10
I know this works in IE 6 and Netscape 7.02. No problems that I have
seen. I have all flavors accessing the site, including a WebTV user,
1100 all together and I haven't heard anyone scream.

Alex

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #11
Wow, that's quite remarkable. Would you mind sharing the code? :)

--
Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
"Alex Kail" <ka***@hotmail.com> wrote in message
news:eR**************@tk2msftngp13.phx.gbl...
| I know this works in IE 6 and Netscape 7.02. No problems that I have
| seen. I have all flavors accessing the site, including a WebTV user,
| 1100 all together and I haven't heard anyone scream.
|
| Alex
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #12

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

Similar topics

4
by: Adam | last post by:
Greetings, I am creating a web application, which I will be selling licenses to be able to use it. So Customer Group A, could purchase 3 licenses, Customer Group B could purchase 30. With...
8
by: gil | last post by:
I'm trying to track how many users are visiting a site and how may are logged in, using application sessions like so: Sub Session_OnStart Session.Timeout = 20 Session("Start") = Now...
2
by: Derek | last post by:
Hello: I want to capture the event when a browser is closing, to give to the user the posibility of close or no this browser. When the browser is closing, this show a confirm window with two...
4
by: tperri | last post by:
I've got a user table with a field called Online, and when a user logs in, I set a value in this column to indicate they are online. And in the same fashion, when they click the logout button, I...
6
by: Bill Manring | last post by:
I have an ASP.NET application which my company sells comercially. We license on a concurrent user model, but we currently rely on the "honor" system for the customers to give us their best guess...
1
by: kasterborus | last post by:
Hi, My client is using the UBB Threads forum and I was recently asked to look into adding the ability to track the activity of each of the users to see who is more active than others. Users are...
2
by: C# programmer | last post by:
Hi All, I'm working on a project which requires tracking of recent document downloads. There is a feature in which user can download the docs without logining into the website for some of the...
9
by: Jonathan Wood | last post by:
I've spent days trying to come up with a solution. I'd appreciate it if anyone can help. My site requires all users to log on. There are three different roles of users, and each user type will...
10
junior29
by: junior29 | last post by:
Hi, I just wondered if anyone could help me at all. I'm doing a piece of coursework building a social network (which is getting there!), we are supposed to add an administration element to...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.