Firefox Tomorrow

web api instance property

Navigator: devicePosture property

View on MDN ↗

Limited availability

The Navigator.devicePosture read-only property returns the browser’s DevicePosture object, which allows developers to query the device’s current posture (that is, whether the viewport is in a flat or folded state) and run code in response to posture changes.

Value

A DevicePosture object.

Examples

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

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also