Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Device Memory API

Device Memory API

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Note: This feature is available inWeb Workers.

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 retrievingNavigator.deviceMemory orWorkerNavigator.deviceMemory.

js
const RAM = navigator.deviceMemory;

Client Hints

You may also use theClient Hints HTTP Header with theDevice-Memory directive to retrieve the same approximate RAM capacity.

Interfaces

Extensions to other interfaces

Navigator.deviceMemoryRead only

Returns the approximate amount of device memory in gigabytes.

WorkerNavigator.deviceMemoryRead only

Returns the approximate amount of device memory in gigabytes.

Specifications

Specification
Device Memory

Browser compatibility

api.Navigator.deviceMemory

api.WorkerNavigator.deviceMemory

http.headers.Device-Memory

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp