25

Command $(document).referrer is the correct way to get referrer with Jquery?

vernomcrp
  • 3,459
  • 11
  • 34
  • 44

1 Answers1

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
  • 2
    here'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