Navigator: deviceMemory property
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 insecure contexts (HTTPS), in some or allsupporting browsers.
ThedeviceMemory read-onlyproperty of theNavigator interface returns the approximate amount ofdevice memory in gigabytes.
The reported value is imprecise to curtailfingerprinting. It's approximated byrounding down to the nearest power of 2, then dividing that number by 1024. It is thenclamped within lower and upper bounds to protect the privacy of owners of very low-memory orhigh-memory devices.
In this article
Value
A floating point number; one of0.25,0.5,1,2,4,8.
Examples
js
const memory = navigator.deviceMemory;console.log(`This device has at least ${memory}GiB of RAM.`);Specifications
| Specification |
|---|
| Device Memory> # sec-device-memory-js-api> |
Browser compatibility
See also
Device-MemoryHTTP header