Navigator: devicePosture-Eigenschaft
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.
Die schreibgeschützte Navigator.devicePosture
-Eigenschaft gibt das DevicePosture
-Objekt des Browsers zurück. Dieses ermöglicht es Entwicklern, die aktuelle Haltung des Geräts abzufragen (also ob der Viewport flach oder gefaltet ist) und Code entsprechend auf Haltungsänderungen zu reagieren.
Wert
Ein DevicePosture
-Objekt.
Beispiele
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);
Spezifikationen
Specification |
---|
Device Posture API # dom-navigator-deviceposture |
Browser-Kompatibilität
BCD tables only load in the browser
Siehe auch
DevicePosture
devicePosture.type
- Device Posture API
- CSS
device-posture
-@media
-Feature