--- title: DeviceMotionEvent slug: Web/API/DeviceMotionEvent translation_of: Web/API/DeviceMotionEvent ---
{{apiref("Device Orientation Events")}}{{SeeCompatTable}}
DeviceMotionEvent
提供了網頁開發者關於裝置位置及旋轉方向改變時的速度資訊。
Warning: Currently, Firefox and Chrome does not handle the coordinates the same way. Take care about this while using them.
window.addEventListener('devicemotion', function(event) { console.log(event.acceleration.x + ' m/s2'); });
Specification | Status | Comment |
---|---|---|
{{SpecName('Device Orientation')}} | {{Spec2('Device Orientation')}} | Initial specification. |
{{ CompatibilityTable() }}
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | {{ CompatVersionUnknown() }} | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("6")}} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{ CompatVersionUnknown() }} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("6")}} | {{ CompatNo() }} | {{ CompatNo() }} | 4.2 |