View Single Post

  #3 (permalink)  
Old 05-08-2008
Piotr
 
Posts: n/a
Default Re: How to detect user leaving site?

Erwin Moller wrote:
> sebastian schreef:
>> Can this be done without client-side scripting? I thought sessions
>> might be the answer but after some testing found that sometimes the
>> old session data remained even after the user left the site and
>> returned. Just had an idea, though. Perhaps I could access the users
>> Referrer header?

>
> Hi Sebastian,
>
> I think you cannot detect this without JavaScript.
> If somebody goes somewhere else, your server is not notified.
> You can only try this via JavaScript.
>
> Referer:
> And I don't see how the Referer header can help you out.
> It is send to the next site (if send at all).
>
> Session:
> No go either.
> A Session is nothing more than a piece of data on the server that is
> linked to a certain visitor via a PHPSESSID (via cookie/url/form).
> I don't see how they can help you with this.
>
> So bottomline, bad luck.
> You need JavaScript (or some other clientside technology, like an JAVA
> applet).


Correct me if I'm wrong, but if user left his site, and then returned
refer would point to the other site. So detecting refer value could
possibly help the problem.

@Sebastian
Refer it's send by the user, so can't be trusted. You can use it
to improve the functionality of the site, but don't use it to any
critical checks (like access controll ect.).

It's also possible, that refer will be empty, when user types in the url
or opens new window in 'new tab' (not sure about that though).

best regards
Piotr N
Reply With Quote