google-chromehttp-headersmeta-tagsrobots.txt

HTTP header to detect a preload request by Google Chrome


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).

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)?

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).

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


Solution

  • 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 does similarly, using: X-Purpose: preview. According to this ticket , Chrome does, too.

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

    source, additional reading