files/en-us/web/api/deviceposture/index.md
{{APIRef("Device Posture API")}}{{SeeCompatTable}}
The DevicePosture interface of the {{domxref("Device Posture API", "Device Posture API", "", "nocode")}} represents the device's posture, that is, whether the viewport is in a flat or folded state.
{{InheritanceDiagram}}
Inherits properties from its parent, {{DOMxRef("EventTarget")}}.
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);
{{Specifications}}
{{Compat}}
@media feature