当用户使用后退按钮时是否可以知道用户来自哪里?

发布于 2024-07-23 02:48:26 字数 166 浏览 3 评论 0原文

例如,

如果用户访问 google -> example.com -> newwebsite.com

如果他返回 example.com,http-referrer 页面仍将是 google.com

我如何检测到他访问了 newwebsite.com

For example,

if user goes to google -> example.com -> newwebsite.com

If he goes back to example.com, the http-referrer page will still be google.com

How can I detect that he went to newwebsite.com

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

就此别过 2024-07-30 02:48:26

我相信后退按钮将发送第一次发送到该网站的 HTTP 标头,因为它实际上并不是一次新访问。

假设如果用户的 http-referrer 是 newwebsite.com,您会显示一个错误页面。 他们第一次访问时,他们会得到您的网站。 如果他们访问 newwebsite.com,然后返回(意味着他们想通过浏览器历史记录回到过去,而不是再次使用新标题加载页面),那么他们会得到一个错误页面,并且该页面的性质后退按钮将被击败。 我不知道这是否会激发这种行为,但这对我来说是有意义的。

也许这是可能的,但它完全依赖于浏览器。 无论如何,为什么需要这个功能? Newwebsite 根本不会将用户引向您的网站,两者之间根本没有任何联系 - 它只是恰好是用户访问的最后一个页面。

I believe that the back button will send the HTTP headers that were sent to the site the first time around, since it's not really a new visit.

Say you displayed an error page if the user's http-referrer was newwebsite.com. The first time they visited, they would get your site. If they went to newwebsite.com, and then hit back (meaning they wanted to go back in time, through their browser history, not load the page again with new headers), then they would get an error page, and the nature of the back button would be defeated. I don't know if this inspires that behavior or not, it just makes sense to me that way.

Maybe it's possible, but it would be entirely browser-dependent. Why do you need this functionality, anyway? Newwebsite isn't referring the user to your website at all, there's no connection between the two at all--it just happens to be the last page that the user visited.

您的好友蓝忘机已上羡 2024-07-30 02:48:26

如果访问者使用后退按钮,则可能会从浏览器缓存加载页面。 在这种情况下,不会发送推荐人。
使用谷歌分析,您可以看到有多少访问者来自给定的网站。 这可能会给您一些信息。

If a visitor uses the back button, the page might be loaded from browser cache. In that case, no referrer is sent.
Using google analytics, you can see how many visitors came from a given web site. This might give you some information.

流绪微梦 2024-07-30 02:48:26

我不认为这通常是可能的。 您可以在您的网站上使用 javascript 进行一些技巧,以便可以检测并记录从那里导航的所有链接,但是一旦用户离开您的网站,您就无法控制。

如果您提供了浏览器,即。 如果您自己开发了浏览器历史记录,那么您可以选择通过 api 公开浏览器历史记录。

http://jeremiahgrossman.blogspot.com/2006/ 08/i-know-where-youve-been.html

描述了一种利用浏览器协议修改链接以指示它们已被遍历的技术(例如,更改链接的颜色),以便访问的网站可以被检测到,但这仅适用于预先声明的一组链接,它不是普遍适用的方法。

我的感觉是,试图隐藏浏览器的本质(用户可以到处跳转)往往会导致 79% 的解决方案令人不满意,让用户感到困惑。

您实际上想解决什么问题?

I don't believe that this is generally possible. You could pull tricks with javascript on your site so that all the links navigated from there could be detected and recorded, but once the users off your site you've got no control.

If you provided the browser, ie. developed your one yourself, then you could choose to expose the browser history via an api.

http://jeremiahgrossman.blogspot.com/2006/08/i-know-where-youve-been.html

Describes a technique for exploiting the browsers agreement to modify links to indicate that they have been traversed (eg. changing the colour of the link) so that visited sites can be detected, however this only works for a pre-declared set of links, it's not a generally applicable approach.

My feeling is that attempts to hide the nature of browsers - users can hop around all over the place - tend to lead to unsatisfactory 79% solutions that mystify users.

What problem are you actually trying to solve?

笑咖 2024-07-30 02:48:26

您可以使用会话来跟踪页面的路径。它确实有效。尝试一下。

You can use sessions inorder to track the path of pages.it really works wwell.try it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文