HTTP header to detect a preload request by Google Chrome HTTP header to detect a preload request by Google Chrome google-chrome google-chrome

HTTP header to detect a preload request by Google Chrome


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


Chrome stopped sending X-Purpose header in 2011 and they stated that they won't fix it there: https://code.google.com/p/chromium/issues/detail?id=86175.

They re-introduced sending Purpose:prefetch headers with all nostate-prefetch requests back in 2018 as stated by the last comment on this issue. https://bugs.chromium.org/p/chromium/issues/detail?id=86175#c65