HTTP header to detect a preload request by Google Chrome

后端 未结 2 1164
[愿得一人]
[愿得一人] 2020-12-06 16:47

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 qu

相关标签:
2条回答
  • 2020-12-06 17:03

    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

    0 讨论(0)
  • 2020-12-06 17:23

    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

    0 讨论(0)
提交回复
热议问题