What is the definition of HTTP_X_PURPOSE?

2020-08-25 05:05发布

Recently we've been looking at a few exceptions captured in our Stack Overflow logs and have discovered an issue for Safari users.

I noticed this HTTP header in one of the exceptions we have captured:

HTTP_X_PURPOSE  preview

Does anyone know what action triggers this header or the meaning of HTTP_X_PURPOSE?

2条回答
放我归山
2楼-- · 2020-08-25 05:41

Might be sent when rendering for the Safari 4.0 Top Sites display mode? Haven't tested, just a guess.

查看更多
戒情不戒烟
3楼-- · 2020-08-25 05:46

The "X-Purpose: preview" header is definitely a Safari 4 top sites thing. The Top Sites page tries to show a live-ish thumbnail of the favourite pages. If favourite page is open in a tab, it grabs a thumbnail from the current version of the page. If a page is not available in an open tab, and the thumbnail is sufficiently out of date*, it makes a background request to get the current version of the page.

The X-Purpose: preview header is only attached to the HTTP request for the base URL. It is not attached to the resources (JS/CSS/images/flash) referenced on the page.

I've just written a blog entry on this over here: https://web.archive.org/web/20131115045854/https://sunpig.com/martin/archives/2010/01/08/how-to-detect-a-page-request-from-safari-4s-top-sites-feature.html

(* I haven't explored its criteria for "sufficiently out of date" yet.)

查看更多
登录 后发表回答