如何通过 javascript include 获取 Url Referer?
如果我在 google 上搜索某些内容并单击结果 (mytestsite.com),则该网站的引荐来源网址将是 google 搜索的 URL。
现在在该站点上,有一个用于跟踪目的的 JS 文件包含..但是该 JS 文件请求的引用者是 mytestsite.com...处理 JS 请求的服务器没有办法知道它的来源吗来自谷歌搜索?
If I search for something on google and click on a result (mytestsite.com), the referer to that site will be URL of the google search.
Now on that site, there is a JS file include that is used for tracking purposes..however the referrer to that JS file request is mytestsite.com...is there no way for the server handling the JS request to know that it originated from a google search?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有点不清楚你想要做什么,但你可以使用 JavaScript 来获取引荐来源网址:
...并将其在 JS 文件请求中传递到服务器。有几种方法可以做到这一点......这是一种:
I'm a little unclear on what you are trying to do, but you can grab the referrer with JavaScript using:
...and pass it along to the server in your request for the JS file. Several ways to do this...here's one:
脚本标签将始终引用其来源的文档。如果您在服务器上做一些特殊的事情,您可能需要考虑使用会话或 cookie。
A script tag will always refer to the document that is sourcing it. If you're doing something special on the server you might want to consider using a session or cookies.