How do I find the a referring sites URL in node?
I'm using express, would I find this in the headers on connect or something?
Thanks!
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.
If you want to get the path info from request urlvar url_parts = url. parse(req. url); console. log(url_parts); console.
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.
You have to store in session. app. get('/url1', function(req, res){ res. send('ok') req.
In express 4.x:
req.get('Referrer')
This will also check both spellings of referrer so you do not have to do:
req.headers.referrer || req.headers.referer
Here is the documentation
If you mean how do you get it when running an express server, then it's done using the header method on your request:
req.headers.referer; // => "http://google.com"
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