简体   繁体   English

从用户重定向到我的网站的位置获取 url

[英]Get the url from where the user is redirected to my site

所以,几天前我在 github 上看到了见解,他们给出了流量来源,我如何使用 node.js (express) 做到这一点?

I believe you're looking for req.hostname .我相信您正在寻找req.hostname Have you tried it?你试过吗? It returns the first X-Forwarded-Host .它返回第一个X-Forwarded-Host


Example (from previously linked documentation):示例(来自之前链接的文档):

// Host: "example.com:3000"
console.dir(req.hostname)
// => 'example.com'

You can get it with:您可以通过以下方式获取:

document.referrer

Which returns:返回:

the URI of the page that linked to this page.链接到此页面的页面的 URI。 MDN MDN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 Postman 获取重定向的 URL - Get redirected URL from Postman 从 XMLHttpRequest 重定向 url - get redirected url from XMLHttpRequest 如何使我的网站避免从URL缩短网站重定向(如goo.gl)? - How to make my website avoid being redirected from the URL shortener site (Like goo.gl)? 如何从重定向的 url 获取查询数据 - How to get query data from redirected url 如何确保只有从特定功能重定向的用户才能访问我的网站页面? - How can I make sure that a user visits a page of my site only if he's redirected from a specific function? jquery获取重定向的URL - jquery get redirected url chrome 扩展 - 在使用 declarativeNetRequest 重定向用户之前获取 url - chrome extension - get url before user is redirected using declarativeNetRequest 在重定向到登录之前,阻止Angular站点上的未授权用户暂时查看站点的最佳方法是什么? - Best way to prevent unauthorized user on Angular site from seeing site for a split second before being redirected to login? Netsuite SuiteScript如何从重定向的URL中获取价值 - Netsuite SuiteScript how to get value from the redirected url 从网站获取图像URL - Get Image URL from site
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM