Forum Moderators: open

Message Too Old, No Replies

onUnLoad

only works 80% of the time

         

sabrawv

6:42 pm on Apr 12, 2004 (gmt 0)

10+ Year Member



First, let me say that i am new at this stuff. Here's my problem. Our goal is to find out how long users stay on a page... are they reading the content or leaving immediately. Though it's impossible to really know this, we're hoping to get a general idea. What we currently have is an onLoad event that creates a date object and then names an image based on the time. Then, our onUnload event creates a date object and then uses the onLoad date object in conjunction with the onUnLoad date object to determine the time on page. It then creates an image based on this time. Then we are able to look in the log and determine the time on page. PROBLEM: All of our onLoad events are logged but only 80% of the onUnLoad events are logged. Why is the onUnLoad event being missed? What can we do to fix it? Thanks for any and all replies.

Rambo Tribble

10:44 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like you are asking too much of your function that is triggered by onunload. It is commonly advised that you keep your onunload code very brief, or it might not execute before the page dies.

There are other things that can prevent onunload from working, like a spontaneous power down event, but your 20% failure rate suggests the above. Shorten your code and eliminate the creation of so many objects.