这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
弃用
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the
兼容性表格
at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
hasOrientation
只读特性在
VRDisplayCapabilities
interface returns a
布尔
stating whether the VR display can track and return orientation information.
var hasItGotOrientation = vrDisplayCapabilitiesInstance.hasOrientation;
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 'hasOrientation' in that specification. |
草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
hasOrientation
弃用
|
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