安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
Capabilities of the client devices largely depend on the amount of available RAM. Traditionally, developrs had to use heruistics and either benchmark the device or infer the device capabilities based on other factors like device manufacturer or User Agent strings.
There are two ways to acces the approximate amount of RAM device has: via JavaScript API and via Client Hints HTTP header.
You may query the approximate amount of ram device has by retreiving
Navigator.deviceMemory
var ram1 = window.navigator.deviceMemory; var ram2 = navigator.deviceMemory;
Both of these will return the same result.
You also may use
Client Hints
directive
Device-Memory
to retreive the same approximate RAM capacity.
| 规范 | 状态 | 注释 |
|---|---|---|
| Device Memory 1 | 编者草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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
|
Chrome 61 | Edge ≤79 | Firefox ? | IE ? | Opera 48 | Safari ? | WebView Android 61 | Chrome Android 61 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 8.0 |
完整支持
兼容性未知
实验。期望将来行为有所改变。