Skip to content

Instantly share code, notes, and snippets.

@SeanJA
Created October 3, 2012 22:44
Show Gist options
  • Save SeanJA/3830362 to your computer and use it in GitHub Desktop.
Save SeanJA/3830362 to your computer and use it in GitHub Desktop.
Get the referrer in jQuery
jQuery.fn.referrer = function() {
return jQuery(document).prop("referrer").toString();
};
//usage:
jQuery().referrer()
@SeanJA
Copy link
Author

SeanJA commented Oct 3, 2012

This is a joke... don't use this

Copy link

ghost commented Oct 4, 2012

Needs more function calls...

return jQuery(document).prop("referrer");

Voilà!

@SeanJA
Copy link
Author

SeanJA commented Oct 4, 2012

@kitcambridge I added your fix, also added a toString... just to make sure it really is for realz a string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment