如何知道传入的请求是否来自搜索引擎机器人?
有谁知道如何检测传入请求是否来自搜索引擎机器人? HTML 标头是否包含任何特定信息?
Does anyone know how to detect whether an incoming request is from a search engine robot? Do HTML headers contain any specific info for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您通常可以使用 IP 和 HTTP 标头中的用户代理的组合来弄清楚。这里有一篇关于它的文章:http://www.jafsoft.com/searchengines/spider_hunting。 html
You can usually use a combination of IP and the user agent in the HTTP headers to figure it out. There is an article all about it here: http://www.jafsoft.com/searchengines/spider_hunting.html
HTTP 请求有一个名为“用户代理”的字段。该字段指定请求是否来自 Mozilla、Internet Explorer 或某些搜索引擎机器人。 Java、php都有自己的命令来读取这个用户代理字段。
HTTP request has a field named 'user agent'. This field specifies if the request came from Mozilla or internet explorer or some search engine bot. Java, php each has its own command to read this user agent field.
您可以使用 jQuery 从请求中检查用户代理。
您可以通过 $.browser 获取此信息
,但请记住,这很容易被欺骗。
You can use jQuery to check the user agent from the request.
You can get to this information through $.browser
Keep in mind, though, that this is easily spoofed.