最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React - get referer - Stack Overflow

programmeradmin4浏览0评论

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 ?

Share Improve this question edited Jan 5, 2022 at 17:03 Ross Rogers 24.2k28 gold badges114 silver badges171 bronze badges asked Aug 2, 2016 at 8:12 omriman12omriman12 1,6907 gold badges28 silver badges53 bronze badges 2
  • 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
Add a ment  | 

1 Answer 1

Reset to default 13

Here 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

发布评论

评论列表(0)

  1. 暂无评论