如何在不增加点击计数器的情况下访问网页?
我经常访问网络上的某个页面来查看点击计数器,但我的访问次数每次都会被计算在内,从而夸大了实际点击次数。有没有一种方法可以访问该页面而不向点击计数器添加另一个点击?
I frequently visit a certain page on the web to view the hit-counter, but my visit is counted every time and it's inflating the number of actual hits. Is there a way to visit the page without adding another hit to the hit counter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在这种情况下,命中计数器的实现被破坏。通常只应按唯一用户来计算点击次数。否则,任何暴徒都可以设置一个重新加载机器人并吹掉柜台上的数字。真正的计数解决方案将使用来自 google 的分析 API(或其他分析实现)之类的东西,这将使您能够通过仪表板访问网站的真实可见性。
In this case, the hit counter implementation is broken. Hits should only be counted by unique users usually. Otherwise any goon could set a reload bot and blow out the numbers on the counter. A real counting solution is going to be using something like the analytics API from google (or other analytics implementations) which will give you dashboard access to the real visibility of the site.
没有完美的方法来解决它。但一个很好的方法是在访问者的浏览器上设置 cookie。然后,仅当该 cookie 尚未访问您的页面时才继续计数。这种方法的最大问题是,跟踪页面上的每个访问者可能会导致您访问一个巨大的数据库。
There is no perfect way to solve it. But a pretty good approach is setting cookies on visitor's browser. Then, keep counting only if that cookie did not visit your page yet. The biggest problem with this approach is that keeping track of every single visitor on your page could potentially lead you to a huge database.
如果您想自己实现点击计数器,那么您可以使用“会话”,并且仅当会话不存在于具有现有 IP 的服务器中时才增加点击计数器。但我不认为你有办法控制别人网站上的点击计数器。
if you want implement the hit counter yourself then what you can do is use 'sessions' and only increment hit counter when the session isn't present in the server with existing ip. but i don't think there is a way for you to control hit counter on someone else's website.
尝试将您的 IP 添加到计数器并在代码中阻止它,或者您可以使用 javascript 禁用插件.. FF 和 chrome 的 Web 开发人员插件也可以这样做。
Try to add your IP to hit counter and block it in the code or you can use an javascript disable plugin .. web developer plugin for FF and chrome does that too.