安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
deviceMemory
只读特性在
Navigator
interface returns the approximate amount of device memory in gigabytes.
The reported value is imprecise to curtail fingerprinting. It’s approximated by rounding down to the nearest power of 2, then dividing that number by 1024. It is then clamped within lower and upper bounds to protect the privacy of owners of very low- or high-memory devices.
memoryAmount = navigator.deviceMemory
A floating point number; one of
0.25
,
0.5
,
1
,
2
,
4
,
8
.
const memory = navigator.deviceMemory
console.log (`This device has at least ${memory}GiB of RAM.`)
| 规范 | 状态 | 注释 |
|---|---|---|
|
Device Memory 1
The definition of 'deviceMemory' in that specification. |
编者草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
deviceMemory
|
Chrome 63 | Edge ≤79 | Firefox ? | IE ? | Opera 50 | Safari ? | WebView Android 63 | Chrome Android 63 | Firefox Android ? | Opera Android 46 | Safari iOS ? | Samsung Internet Android 8.0 |
完整支持
兼容性未知
实验。期望将来行为有所改变。
Device-Memory
HTTP header
Navigator
activeVRDisplays
appCodeName
appName
appVersion
battery
buildID
clipboard
connection
cookieEnabled
credentials
deviceMemory
doNotTrack
geolocation
keyboard
语言
languages
locks
maxTouchPoints
mediaDevices
mediaSession
onLine
oscpu
permissions
platform
product
productSub
serviceWorker
userAgent
vendor
vendorSub
webdriver
xr