Accept-Ranges
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
HTTP Accept-Ranges
回應標頭是伺服器用來通知其支援的範圍請求,允許用戶端請求資源的一部分或多個部分。此標頭的值表示可用來定義範圍的單位。
例如,回應中若包含 Accept-Ranges
標頭,則表示該伺服器能夠在下載中斷後恢復下載,而不需用戶端從頭重新傳輸。
語法
http
Accept-Ranges: <range-unit>
Accept-Ranges: none
指令
<range-unit>
-
伺服器支援的範圍單位。雖然
bytes
是 RFC 7233 正式定義的唯一範圍單位。範圍單位在 HTTP Range Unit Registry 中註冊。 none
-
不支援任何範圍單位。這相等於省略標頭,因此很少使用。如果服器不支援範圍請求,傳統瀏覽器會利用該值來禁用或移除下載管理器中的暫停按鈕。
範例
http
Accept-Ranges: bytes
規範
Specification |
---|
HTTP Semantics # field.accept-ranges |
瀏覽器相容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Accept-Ranges |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
參見
- HTTP 範圍請求 指南
- HTTP 條件請求 指南
Range
、If-Range
請求標頭- IANA HTTP Range Unit Registry