Navigator: deviceMemory プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。
deviceMemory
は Navigator
インターフェイスの読み取り専用プロパティで、端末のおよそのメモリー量をギガバイト単位で返します。
報告される値は、フィンガープリンティングを抑制するために概数になっています。この値は、最も近い 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.
関連情報
- HTTP の
Device-Memory
ヘッダー