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 GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deviceMemory |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
Device-Memory
HTTP ヘッダー