Device Memory API
The capabilities of a client device largely depend on the amount of available RAM. Traditionally, developers had to use heuristics and either benchmark a device or infer device capabilities based on other factors like the device manufacturer or User Agent strings.
Determining device memory
There are two ways to determine the approximate amount of RAM a device has: use the Device Memory JavaScript API or accept Client Hints.
JavaScript API
You may query the approximate amount of RAM a device has by retrieving Navigator.deviceMemory
var RAM = navigator.deviceMemory;
Client Hints
You may also use the Client Hints HTTP Header with the Device-Memory
directive to retrieve the same approximate RAM capacity.
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
Device_Memory_API |
61 |
≤79 |
? |
? |
48 |
No |
61 |
61 |
? |
? |
No |
8.0 |
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
Device_Memory_API |
63 |
79 |
No |
No |
50 |
No |
63 |
63 |
No |
46 |
No |
8.0 |
JavaScript interface
BCD tables only load in the browser
Client Hints extension
BCD tables only load in the browser
See also