这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
hasExternalDisplay
只读特性在
VRDisplayCapabilities
interface returns a
布尔
stating whether the VR display is separate from the device's primary display.
注意
: If presenting VR content would obscure other content on the device, this will return
false
, in which case the application should not attempt to mirror VR content or update non-VR UI because that content will not be visible.
var hasAnExternalDisplay = vrDisplayCapabilitiesInstance.hasExternalDisplay;
A
布尔
.
function reportDisplays() {
navigator.getVRDisplays().then(function(displays) {
for(var i = 0; i < displays.length; i++) {
var cap = displays[i].capabilities;
// cap is a VRDisplayCapabilities object
var listItem = document.createElement('li');
listItem.innerHTML = '<strong>Display ' + (i+1) + '</strong>'
+ '<br>VR Display ID: ' + displays[i].displayId
+ '<br>VR Display Name: ' + displays[i].displayName
+ '<br>Display can present content: ' + cap.canPresent
+ '<br>Display is separate from the computer\'s main display: ' + cap.hasExternalDisplay
+ '<br>Display can return position info: ' + cap.hasPosition
+ '<br>Display can return orientation info: ' + cap.hasOrientation
+ '<br>Display max layers: ' + cap.maxLayers;
list.appendChild(listItem);
}
});
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebVR 1.1
The definition of 'hasExternalDisplay' in that specification. |
草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
hasExternalDisplay
弃用
|
Chrome No | Edge 15 — 79 |
Firefox
55
|
IE No | Opera ? | Safari ? | WebView Android No |
Chrome Android
56 — 80
Disabled
|
Firefox Android 55 | Opera Android ? | Safari iOS ? |
Samsung Internet Android
6.0
|
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
弃用。不要用于新网站。
见实现注意事项。
用户必须明确启用此特征。
VRDisplayCapabilities
canPresent
hasExternalDisplay
hasOrientation
hasPosition
maxLayers