I have an url
domain.com/a
which redirects to
domain.com/controller/action/a
.
How do I get the referrer (i.e domain.com/a) in my action for domain.com/controller/action/a ?
One option was to add the referring domain as a parameter .
domain.com/controller/action/a?referral=domain.com/a
.
Is there a way to get the referrer without passing old referrer as a parameter. Like we would get from **request.referrer**
. request.referrer doesn't seem to work with redirected urls.
I am using Ruby on Rails for my development.
To check the Referer in action go to Inspect Element -> Network check the request header for Referer like below. Referer header is highlighted. Supported Browsers: The browsers are compatible with HTTP header Referer are listed below: Google Chrome.
The address of the webpage where a person clicked a link that sent them to your page. The referrer is the webpage that sends visitors to your site using a link. In other words, it's the webpage that a person was on right before they landed on your page.
Some web browsers give their users the option to turn off referrer fields in the request header. Most web browsers do not send the referrer field when they are instructed to redirect using the "Refresh" field. This does not include some versions of Opera and many mobile web browsers.
The Referer HTTP request header contains an absolute or partial address of the page that makes the request. The Referer header allows a server to identify a page where people are visiting it from. This data can be used for analytics, logging, optimized caching, and more.
I store the referrer path in the session right before redirection
session[:referrer]=url_for(params)
and then use it where I need it via session[:referrer]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With