HTTP标头可检测Google Chrome的预加载请求 [英] HTTP header to detect a preload request by Google Chrome

查看:399
本文介绍了HTTP标头可检测Google Chrome的预加载请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Chrome 17推出了新的功能预先加载一个网页,以提高实际提出请求时的渲染速度(点击进入omnibar)。

Google Chrome 17 introduced a new feature which preloads a webpage to improve rendering speed upon actually making the request (hitting enter in the omnibar).

有两个问题:
是否有HTTP头来检测请求在服务器端,如果实际存在什么是适当的响应,以防止这种预加载(以防止意想不到的请求,可能有不必要的影响)?

Two questions: Is there a HTTP header to detect such a request on server side, and if one actually exists what is the proper response in order to prevent such preloading (to prevent unintended requests which might have unwanted effects)?

Google Chrome在提出预加载请求之前检查robots.txt?
是否有robots.txt设置只针对这种特定行为? (我希望/希望不允许已经有效)。

Does Google Chrome check the robots.txt before making preload requests? Is there a robots.txt setting which targets only this specific behaviour? (I supose/hope disallow already works).

是否有元标记可以通知Google Chrome无法在当前网域再次预加载?

Is there a meta tag to inform Google Chrome to never preload again on the current domain?

推荐答案

包含请求的头部:X-moz:
prefetch

When Firefox pre-fetches content (at the behest of the referrer page’s markup), it sends the following header with the request: X-moz: prefetch

Safari的操作同样适用:X-Purpose:预览。根据这个
的门票,Chrome也是如此。

Safari does similarly, using: X-Purpose: preview. According to this ticket , Chrome does, too.

对于预渲染,Chrome不会向
客户端发送任何标题。相反,我们必须在JS中使用页面可见性API。

For pre-rendering, Chrome does not send any header whatsoever to the client. Instead, one must use the Page Visibility API, in JS

来源附加阅读

这篇关于HTTP标头可检测Google Chrome的预加载请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆