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>

伺服器支援的範圍單位。雖然 bytesRFC 7233 正式定義的唯一範圍單位。範圍單位在 HTTP Range Unit Registry 中註冊。

none

不支援任何範圍單位。這相等於省略標頭,因此很少使用。如果服器不支援範圍請求,傳統瀏覽器會利用該值來禁用或移除下載管理器中的暫停按鈕。

範例

http
Accept-Ranges: bytes

規範

Specification
HTTP Semantics
# field.accept-ranges

瀏覽器相容性

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-Ranges

Legend

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

Full support
Full support

參見