WorkerNavigator: deviceMemory プロパティ

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

WorkerNavigator インターフェイスの読み取り専用プロパティ deviceMemory は、デバイスのメモリのだいたいの量をギガバイト単位で返します。

報告される値は、フィンガープリンティングを抑えるため、不正確です。値は、一番近い 2 の累乗に切り捨て、その後 1024 で割ることで近似されます。その後、メモリが非常に少ないまたは非常に多いデバイスの所有者のプライバシーを守るため、下限と上限の間にクランプされます。

浮動小数点数で、0.25, 0.5, 1, 2, 4, 8 のいずれかです。

以下のコードはワーカー内で実行できます。

js
const memory = navigator.deviceMemory;
console.log(`このデバイスには少なくとも ${memory} GiB の RAM があります。`);

仕様書

Specification
Device Memory
# sec-device-memory-js-api

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
deviceMemory

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

関連情報