Command $(document).referrer is the correct way to get referrer with Jquery?
Asked
Active
Viewed 4.1k times
25
-
5google: http+referrer+javascript? – gblazex Jun 30 '10 at 10:12
-
urm I did - that's how I got here :-) plus I never remember how to incorrectly spell `refer*er` correctly – Simon_Weaver Sep 28 '15 at 02:23
1 Answers
67
How about just:
document.referrer

Matthew Flaschen
- 278,309
- 50
- 514
- 539
-
That's great if it works, but `document.referrer` is not set in my version, so what's the answer in that case? – user9645 Jun 12 '13 at 19:38
-
1@user9645, what do you mean "your version"? All modern browsers (and then some) should support `document.referrer`. That doesn't mean the value is always set, though. It depends on user settings, extensions, etc. – Matthew Flaschen Jun 13 '13 at 05:40
-
2here's a couple useful article if you're finding `document.referrer` is null. (most important thing is to make sure your site is https) http://smerity.com/articles/2013/where_did_all_the_http_referrers_go.html https://www.facebook.com/notes/facebook-engineering/protecting-privacy-with-referrers/392382738919 – Simon_Weaver Sep 28 '15 at 02:20