...

View Full Version : saving leaving time



joonstar
10-19-2003, 02:04 AM
I like to make a user to visit goodbye.html page whe he or she leaves my site.

Let's suppose my site has just two pages, ie index.html and goodbye.html.


if the user closes the winodw or enters another address into address input box of the browser, it is forced to visit the goodbye page, or the goodbye page is popped up.


My purpose on this is saving the leaving time into my database.

will you show me the right way for this?

beetle
10-19-2003, 04:41 AM
I would recommend something like this, as it would be the least intrusive and won't be blocked by popup blockers


<script type="text/javascript">
onunload = function()
{
var i = new Image();
i.src = "goodbye.html";
}
</script>

And let your server-side code in goodbye.html save the IP and time to the DB.

oracleguy
10-19-2003, 05:16 AM
Yeah, cuz redirecting someone after they type an address in to some other place would be quite rude.

joonstar
10-19-2003, 05:22 AM
<html>
<head>

<script type="text/javascript">
onunload = function()
{
var i = new Image();
i.src = "goodbye.htm";
}
</script>

</head>

<body>

this is test page.<br>

<a href=another.htm> another page </a>


</body>
</html>


The above is the whole code of the test.htm.

When I click the close button(x button) to close the window,
or
When I click the link to move to another.htm,
or
When I enter a new address in the address input box

I can't find any trace of it visiting goodbye.htm.

Do you see something wrong in my code?

joonstar
10-19-2003, 05:29 AM
Yes, it is quite rude. oracleguy


But this is the first step to find ways for getting some information of user's response.

My target is saving the leaving time without any intrusion.

oracleguy
10-19-2003, 06:36 AM
Is your code on your goodbye page work? Double check that to make sure it is doing everything correctly.

That'd be my guess.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum