[Javascript] RE: onUnLoad question
Anthony Webster
awebster at venda.com
Mon Jun 23 08:43:04 CDT 2003
hi again,
I have struggled with this problem all morning as it is not possible to determine the URL that is going to be loaded. I have found a solution that may interest some of you though. from looking around I found there are 2 ways to trigger my survey when users leave the site.
1. have a hidden frame and put the onUnload there.
2. define a variable such as flag=0 on the page, and on every single link on the page add flag=1 so that internal links don't trigger the survey.
option 2 is not really feasible for me as I dont really want to go through the whole site adding this, so instead I did this:
<body onUnLoad="survey();" onMouseDown="flag();">
it has the desired effect of not triggering the survey anywhere on my site, but only when you navigate away. I am not convinced this is correct, but have tested it and it seems to work fine in version 6 browsers.
anthony
-----Original Message-----
From: Anthony Webster
Sent: 23 June 2003 10:35
To: 'javascript at LaTech.edu'
Subject: onUnLoad question
hi everyone,
I am trying to trigger a customer satisfaction survey when a user leaves our site. Using the onUnLoad event I want to compare the URL of the page the user is on with the URL they are going to, to see if they are leaving the site.
how do I refer to the URL that is about to be loaded?
thanks
anthony
-----------------------
anthony webster
web designer developer
www.venda.com
020 7070 7330
More information about the Javascript
mailing list