开发者

How do I find the a referring sites URL in node?

How do I find the a referr开发者_如何学运维ing sites URL in node?

I'm using express, would I find this in the headers on connect or something?

Thanks!


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"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜