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.

Accept-Ranges HTTP 回應標頭是伺服器用來通知其支援用戶端對文件下載進行部分請求的標記。此欄位的值表示可以用來定義範圍的單位。

如果存在 Accept-Ranges 標頭,瀏覽器可能會嘗試恢復中斷的下載,而不是重新開始下載。

標頭類型 回應標頭
禁止修改的標頭

語法

http
Accept-Ranges: <range-unit>
Accept-Ranges: none

指令

<range-unit>

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

none

表示不支援任何範圍單位。這使得標頭等效於它自己的缺失,因此很少使用。但在某些瀏覽器中,如 IE9,此設置用於禁用或移除下載管理器中的暫停按鈕。

範例

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

參見