473,657 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Server call using onUnload

Hi all,
I'm trying to create a server side log, that will show how much time a
user was present on my web page.

I tried using onUnload and onBeforeUnload to do an http call to the
server.
I've noticed that the call pass to the server is not consistent.

Q:Is there a better way of logging the time user spent on my page
before leaving it?

P.S: currently I'm using an Interval call each 5 sec that logs that the
user is still there.

thanks

Dec 22 '05 #1
3 1859
The call pass will never be consistent. The network/power on the user
side may go down, the user may close/kill the browser window, the user
may turn off javascript (especially if seeing the page calls home every
5s), the network may be slow enough that the call won't be forwarded
before the page is unloaded fully etc. There are things you simply
can't prevent.

An idea I have would be possibly a hidden frame that monitors the
webpage, survives the user following a link, reports the case the page
has been closed and then closes itself gracefully. Of course this
introduces a range of problems that would have to be adressed and some
that can't be addressed. Personally I doubt it can be done reliably
over HTTP.

Dec 22 '05 #2
You can make something using the idea of a chat where you have a
timeout solution...

When the user access your site for the first time (you can use the
session id or ip...), you can fill into the database the current
datetime and a timeout... And in *every* page call you should refresh
this timeout...
Whenever the user gets timed out (for example, after 1 hour of
inactivity), you could set the time he spent on your site...

Another way to do it, is by analyzing the web server log, there you can
check the first ocurrence of the ip on a certain date and make a diff
between it and the last ocurrence...

I would use a 3th party tool like awstats ;]

But if you want to do it on your own, it's ok, good luck :)
--
"Invente, Tente!!! Faça um código eficiente" (Jonas Raoni)

Jonas Raoni Soares Silva
---------------------------
jonasraoni at gmail dot com
http://www.jsfromhell.com

Dec 22 '05 #3
On 2005-12-22, sh************* @gmail.com <sh************ *@gmail.com> wrote:
Hi all,
I'm trying to create a server side log, that will show how much time a
user was present on my web page.
If they save their page to their hard disk does that count as infinite time?

ISTM you are trying to measure the unmeasurable.
I tried using onUnload and onBeforeUnload to do an http call to the
server.
I've noticed that the call pass to the server is not consistent.
if they close the tab or turn off their modem there is no unload.

if they minimise the window, switch to another tab, or leave the room
are they still "present"
Q:Is there a better way of logging the time user spent on my page
before leaving it?
convince them to install your logging software on their PC :)
P.S: currently I'm using an Interval call each 5 sec that logs that the
user is still there.


it'll tell you the page is still open, nothing more.

Bye.
Jasen
Dec 23 '05 #4

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

Similar topics

2
3663
by: Jane | last post by:
Hello, I get the error Error Occured Reading Records: Server has not yet been opened. when I am trying to view a report using the asp pages for crystal reports. It works fine for access files. Can someone help me on it? Thanks in advance! Jane
6
15893
by: kaeli | last post by:
Hey guys, This error occurs ONLY in Netscape 7.0. Not in 7.1. So, I think it's a bug. Buuuut... Has anyone had this problem or know of a fix? When attempting to have an onunload function set with "window.onload=", the error comes up "permission denied to set property window.onunload"
13
1549
by: M B HONG 20 | last post by:
Hi all - I have a .NET web service running on a remote machine, and I have Netscape Navigator 7.0 accessing it through javascript on the client side through SOAP javascript coding. Everything works ok when I run it, meaning the function gets successfully called and everything is fine. I have a window.setInterval on my client side javascript, and it calls the web service function every x milliseconds. However, as soon as I try to...
5
9014
by: jensen bredal | last post by:
Hello, I attended a seminar with scott gu. Microsoft asp.net lead guru, and he mentioned some advanced javascript that let you display an animation while your page is waiting for response from the server. He said these scripts could be found on his blog but , so far i have not been able to find them. I did send him an e-mail but no luck, no response.
1
1077
by: Just D. | last post by:
All, Does anybody know how can I simulate the button click from the JavaScript on ASPX page? Here is the fragment of the ASPX page with a simple JavaScript allowing me to do something before the page Unloads: <script lang="JavaScript"> function OnUnLoad(){
2
5751
by: M B HONG 20 | last post by:
Hi all - I am developing an ASP.NET (C#) application and need some help. I wish to call a server-side function (in the code-behind "file.aspx.cs") upon a user clicking on the "X" to close the browser window. Is there a way to postback and call a server-side function when this happens? I am aware of the browser's native "onunload" event, but am not certain that what I'm looking for is actually possible. Any help would be greatly...
4
4865
by: babu17 | last post by:
hi, i want to fire an event onunload. in the function for the event i want to use an object created by ASP's server.createobject. eg: <%@language = vbscript%> <% set obj1= server.createobject("test.test") %>
3
1599
by: Ricardo Vazquez | last post by:
Hi! I have a new problem with this SCENARIO I already described in a previous post: - PBX (a private telephone exchange or switch) - A Telephony Server Application running on computer "A" (it communicates with the PBX via IP) - An ASP.NET application (running on computer "A") for web clients of that telephony server (running on computer "B", "C", etc.)
3
7363
by: Jimmy | last post by:
It is also possible for popup window to call function in main window by using the opener property. Will "opener.someFunctionInMain(param1, param2)" in the popup window work? It's possible for main window to call function in the popup window, right? The following is a sample code (close popup window causes to show alert window) which doesn't seems to work. Can anyone see the problem? // main
0
8421
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8844
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
2743
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 we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.