Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Get the referrer in jQuery
jQuery.fn.referrer = function() {
return jQuery(document).prop("referrer").toString();
};
//usage:
jQuery().referrer()
@SeanJA

This comment has been minimized.

Show comment Hide comment
@SeanJA

SeanJA Oct 3, 2012

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

Owner

SeanJA commented Oct 3, 2012

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

@kitcambridge

This comment has been minimized.

Show comment Hide comment
@kitcambridge

kitcambridge Oct 4, 2012

Needs more function calls...

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

Voilà!

Needs more function calls...

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

Voilà!

@SeanJA

This comment has been minimized.

Show comment Hide comment
@SeanJA

SeanJA Oct 4, 2012

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

Owner

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