Accept-CH

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

HTTP Accept-CH 回應標頭可以由伺服器設定,以指定用戶在後續請求中應包含哪些用戶端提示標頭。為了確保用戶端提示能夠可靠地傳送,應該對所有安全請求持久化 Accept-CH 標頭。

標頭類型 回應標頭
禁止修改的標頭
CORS 安全清單回應標頭

語法

http
Accept-CH: <client-hints-headers>

// 用戶端提示標頭,以逗號分隔的列表
Accept-CH: <ch-header-one>, <ch-header-two>

範例

用戶端提示回應標頭

以下回應標頭表示伺服器在後續請求中接受 Viewport-WidthWidth 裝置用戶端提示Vary 標頭表示根據接受的用戶端提示來變更回應的值。

http
Accept-CH: Viewport-Width, Width
Vary: Viewport-Width, Width

規範

Specification
HTTP Client Hints
# section-3.1

瀏覽器相容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Accept-CH client hint accept (response) header
Content-DPR token
DeprecatedNon-standard
DPR token
DeprecatedNon-standard
Device-Memory token
Experimental
Sec-CH-UA token
Experimental
Sec-CH-UA-Arch token
Experimental
Sec-CH-UA-Full-Version token
Experimental
Sec-CH-UA-Mobile token
Experimental
Sec-CH-UA-Model token
Experimental
Sec-CH-UA-Platform token
Experimental
Sec-CH-UA-Platform-Version token
Experimental
Viewport-Width token
DeprecatedNon-standard
Width token
DeprecatedNon-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.

參見