Feb 162010
 

The referrer is the URL the user came from. (It gets passed as part of the headers to the new request). You can get it out of rails this way:

request.env[‘HTTP_REFERER’]

Or the shorter version:

request.referrer

It seems that no one noticed that “referer” is actually not a word – the correct spelling is double-R (“referrer”). request.referer and request.referrer both work, but request.env[‘HTTP_REFERRER’] does not.

 Posted by at 3:49 pm  Tagged with:

 Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.