Navigator: thuộc tính devicePosture
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Thuộc tính chỉ đọc Navigator.devicePosture trả về đối tượng DevicePosture của trình duyệt, cho phép nhà phát triển truy vấn tư thế hiện tại của thiết bị (nghĩa là, khung nhìn ở trạng thái phẳng hay gập) và chạy mã để phản hồi các thay đổi về tư thế.
Giá trị
Đối tượng DevicePosture.
Ví dụ
js
const postureOutput = document.getElementById("currentPosture");
function reportPostureOutput() {
// type property returns "continuous" or "folded"
postureOutput.textContent = `Device posture: ${navigator.devicePosture.type}`;
}
navigator.devicePosture.addEventListener("change", reportPostureOutput);
Thông số kỹ thuật
| Specification |
|---|
| Device Posture API> # dom-navigator-deviceposture> |
Khả năng tương thích của trình duyệt
Xem thêm
DevicePosturedevicePosture.type- Device Posture API
- Tính năng CSS
device-posture@media