When I leave a site

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
moiseszaragoza
Forum Commoner
Posts: 87
Joined: Sun Oct 03, 2004 4:04 pm
Location: Ft lauderdale
Contact:

When I leave a site

Post by moiseszaragoza »

I was trying to find out if there is a way to triger a event when then the user leaves the web site

I have looked in unload on a frame but that it not working from a SEO stand point and site user friendly


Thanks
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Javascript, I believe is the only way to determine loss of focus or the movement away from a site.
User avatar
jyhm
Forum Contributor
Posts: 228
Joined: Tue Dec 19, 2006 10:08 pm
Location: Connecticut, USA
Contact:

Post by jyhm »

Everah wrote:Javascript, I believe is the only way to determine loss of focus or the movement away from a site.

Code: Select all

<script type="text/javascript" language="Javascript">
<!-- Hide from older browsers

window.onunload=laterDude;

function laterDude()   {
    alert("Yo! You leaving? Hmmf, like I care, later dude!");
}

// Stop Hiding -->

</script>
User avatar
moiseszaragoza
Forum Commoner
Posts: 87
Joined: Sun Oct 03, 2004 4:04 pm
Location: Ft lauderdale
Contact:

Post by moiseszaragoza »

by any chance do you know how to check when they are leaving the site not each page



thanks
User avatar
jyhm
Forum Contributor
Posts: 228
Joined: Tue Dec 19, 2006 10:08 pm
Location: Connecticut, USA
Contact:

Post by jyhm »

moiseszaragoza wrote:by any chance do you know how to check when they are leaving the site not each page



thanks
Mmmm, not sure. Anything to do with the window is clientside thus delt with by javascript. Maybe some sort of session class but that depends on what exactly you are doin. Of course I might be speakin' out my arse. :wink:
Post Reply