What Web Can Do Today?

Can I rely on the Web Platform features to build my app?

An overview of the device integration HTML5 APIs

Device Memory

The Device Memory API allows Web applications to assess the class of the device by the size of the RAM memory installed. It might be used to identify the lower-end devices to provide the reduced, lightweight experience of the website for performance reasons. The value provided by the API does not hint how much of the memory is actually available for the application to use - its purpose is only to serve as a device class indication.

The API consists of two parts. The first is the memory size exposed via the JavaScript property. The second is the Client Hint mechanism of the browser that sends the total device memory information as Device-Memory HTTP request header when the server previously opted-in to receiving this information with Accept-CH: Device Memory HTTP response header, so that the server side might decide to serve the content optimized for the particular class of device.

API glimpse

navigator.deviceMemory
Returns the approximate total RAM memory size of the device, in GiB.

Live Demo

Your device memory is ~unknown GiB.
  • document.getElementById('result').innerHTML = navigator.deviceMemory || 'unknown'
  • Your device memory is ~<b id="result">unknown</b> GiB.

Resources

Get in touch