Device-Memory header
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
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.
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.
The HTTP Device-Memory request header is used in device client hints to indicate the approximate amount of available RAM on the client device, in gigabytes.
The header is part of the Device Memory API.
Client hints are accessible only on secure origins.
A server has to opt in to receive the Device-Memory header from the client, by first sending the Accept-CH response header.
Servers that opt in to the Device-Memory client hint will typically also specify it in the Vary header to inform caches that the server may send different responses based on the header value in a request.
| Header type | Request header, Client hint |
|---|---|
| Forbidden request header | No |
Syntax
Device-Memory: <number>
Directives
<number>-
The approximate amount of device RAM. Possible values are:
0.25,0.5,1,2,4,8. The amount of device RAM can be used as a fingerprinting variable, so values for the header are intentionally coarse to reduce the potential for its misuse.
Examples
The server first needs to opt in to receive Device-Memory header by sending the Accept-CH response header containing Device-Memory:
Accept-CH: Device-Memory
Then on subsequent requests the client might send Device-Memory header back:
Device-Memory: 1
Specifications
| Specification |
|---|
| Device Memory> # iana-device-memory> |
Browser compatibility
See also
- Improving user privacy and developer experience with User-Agent Client Hints (developer.chrome.com)
- Device Memory API
Navigator.deviceMemoryWorkerNavigator.deviceMemory- Device client hints
Accept-CH- HTTP Caching: Vary and
Vary