Device-Memory header
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
Warning:
Tiêu đề Device-Memory đã được chuẩn hóa thành Sec-CH-Device-Memory và tên mới hiện được ưu tiên.
Tiêu đề HTTP Device-Memory request header được sử dụng trong gợi ý máy khách thiết bị để chỉ báo lượng RAM khả dụng gần đúng trên thiết bị máy khách, tính bằng gigabyte.
Tiêu đề là một phần của Device Memory API.
Gợi ý máy khách chỉ có thể truy cập trên các nguồn gốc an toàn.
Máy chủ phải chọn tham gia để nhận tiêu đề Device-Memory từ máy khách, bằng cách gửi tiêu đề phản hồi Accept-CH trước.
Các máy chủ chọn tham gia gợi ý máy khách Device-Memory thường cũng chỉ định nó trong tiêu đề Vary để thông báo cho bộ nhớ đệm rằng máy chủ có thể gửi các phản hồi khác nhau dựa trên giá trị tiêu đề trong yêu cầu.
| Loại tiêu đề | Request header, Gợi ý máy khách |
|---|---|
| Forbidden request header | Không |
Cú pháp
Device-Memory: <number>
Chỉ thị
<number>-
Lượng RAM thiết bị gần đúng.
Lượng RAM thiết bị có thể được sử dụng như một biến fingerprinting, vì vậy các giá trị cho tiêu đề được cố ý làm thô để giảm khả năng bị lạm dụng. Các giá trị chỉ được báo cáo ở dạng lũy thừa của hai, và bị giới hạn ở giá trị tối thiểu thấp hơn và giá trị tối đa trên được triển khai xác định. Các giới hạn này có thể thay đổi theo thời gian (xem bảng tương thích trình duyệt).
Ví dụ: nếu trình duyệt không báo cáo dưới
2hoặc trên32thì giá trị là một trong:2,4,8,16,32.
Ví dụ
Máy chủ trước tiên cần chọn tham gia để nhận tiêu đề Device-Memory bằng cách gửi tiêu đề phản hồi Accept-CH chứa Device-Memory:
Accept-CH: Device-Memory
Sau đó trong các yêu cầu tiếp theo, máy khách có thể gửi tiêu đề Device-Memory trở lại:
Device-Memory: 1
Đặc tả
This feature does not appear to be defined in any specification.>Khả năng tương thích trình duyệt
Xem thêm
- Improving user privacy and developer experience with User-Agent Client Hints (developer.chrome.com)
- Device Memory API
Navigator.deviceMemoryWorkerNavigator.deviceMemory- Gợi ý máy khách thiết bị và hình ảnh đáp ứng
Sec-CH-Device-MemorySec-CH-DPRSec-CH-Viewport-HeightSec-CH-Viewport-WidthSec-CH-WidthDPRDeprecatedContent-DPRDeprecatedViewport-WidthDeprecatedWidthDeprecated
Accept-CH- HTTP Caching: Vary và
Vary