Skip to content
Advertisement

document.referrer – limitations?

I am unable to get a lot of referral URLS using document.referrer. I’m not sure what is going on. I would appreciate it if anyone had any info on its limitations (like which browser does not support what) etc.

Is there something else i could use (in a different language perhaps) that covers more browsers etc?

Advertisement

Answer

Just to make sure you’re on the same page, you do know that if someone types a URL directly in their web browser, the document.referrer property is empty, right? That being said, you might be interested in a JavScript method to get all HTTP headers. If you prefer PHP (since you’re using that tag), the standard $_SERVER variable will provide what information is available. Note that the information is only as reliable as the reporting web browser and server, as noted by Kev.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement