DevicePosture
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 DevicePosture
-Schnittstelle der Device Posture API repräsentiert die Haltung des Geräts, das heißt, ob die Ansicht in einem flachen oder gefalteten Zustand ist.
Instanz-Eigenschaften
Erbt Eigenschaften von seinem Elternteil, EventTarget
.
type
Schreibgeschützt Experimentell-
Gibt die aktuelle Haltung des Geräts zurück.
Ereignisse
change
Experimentell-
Wird ausgelöst, wenn sich die Haltung des Geräts ändert.
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-deviceposture |
Browser-Kompatibilität
BCD tables only load in the browser
Siehe auch
- CSS
device-posture
@media
-Feature - Device Posture API
- Herkunftstest für faltbare APIs auf developer.chrome.com (2024)