Javascript 如何在节点中找到引用站点 URL?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7237262/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 01:26:34 来源:igfitidea点击:
How do I find the a referring sites URL in node?
提问by fancy
How do I find the a referring sites URL in node?
如何在节点中找到引用站点 URL?
I'm using express, would I find this in the headers on connect or something?
我正在使用快递,我会在连接的标题中找到这个吗?
Thanks!
谢谢!
回答by Ross
In express 4.x:
在 express 4.x 中:
req.get('Referrer')
This will also check both spellingsof referrer so you do not have to do:
这还将检查推荐人的两种拼写,因此您不必执行以下操作:
req.headers.referrer || req.headers.referer
Here is the documentation
这是文档