Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. DevicePosture

DevicePosture

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

TheDevicePosture interface of theDevice Posture API represents the device's posture, that is, whether the viewport is in a flat or folded state.

EventTarget DevicePosture

Instance properties

Inherits properties from its parent,EventTarget.

typeRead onlyExperimental

Returns the device's current posture.

Events

changeExperimental

Fires when the device's posture changes.

Examples

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);

Specifications

Specification
Device Posture API
# dom-deviceposture

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp