I want to get the referrer to the current page.
I have my props.location
, I want the referrer as well.
Very little info on that online, Any suggestions?
I saw maybe an option to use a global variable via App
?
I want to get the referrer to the current page.
I have my props.location
, I want the referrer as well.
Very little info on that online, Any suggestions?
I saw maybe an option to use a global variable via App
?
-
1
document.referer
. It has nothing to do with React – Bikas Commented Aug 2, 2016 at 8:21 - 1 @Bikas its referrer not referer – CyberAbhay Commented Feb 26, 2019 at 9:54
1 Answer
Reset to default 13Here is the way which worked for me to get the referrer URL in react.
var referrer = document.referrer;
console.log("referrer url",referrer);
You can also use the same code in onsubmit function of react-redux