Jump to content

Referring URL


george

Recommended Posts

I guess a lot of browsers block access to the referring URL. But, where there is a will, . . .The history object. I can use it to go back and forth, but I can't get the URL of the previously visited site. Yet I see web stats software that (claim to) gather this info, so that enterprizing sites can find out who is referring them. Can I do this too? It would be best if I could know either a referring URL or if the client came to the site from a link in an email. Should I be looking for a solution on the web server side, using PHP?

Link to comment
Share on other sites

The referer (yeah, it's misspelled) is a header that the browser sends. I'm not sure if Javascript can access the HTTP headers or not (it's entirely possible), but I know that a language like PHP can. In PHP the $_SERVER['HTTP_REFERER'] variable contains the referer, if any, that the browser sent. The referer header would not be sent for something like clicking a link in an email or typing an address into the browser, and a browser will also not send the referer if someone clicks a link from an https page to an http page. A secure referer going to an insecure page will not be sent, in that case the referer is purposely left empty. If you want to track an email click, you would need to include an extra variable in the URL to indicate to the server that the link came from an email.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...