ConceptioArchiveW3C TR
W3C TRopen access

gyroscope

W3C · w3c_tr
W3C TR · Standards · License: Open Access
Open Source ↗
w3c, standard

Gyroscope W3C Candidate Recommendation Draft , 14 May 2026 More details about this document This version: https://www.w3.org/TR/2026/CRD-gyroscope-20260514/ Latest published version: https://www.w3.org/TR/gyroscope/ Editor's Draft: https://w3c.github.io/gyroscope/ Previous Versions: https://www.w3.org/TR/2026/CRD-gyroscope-20260202/ History: https://www.w3.org/standards/history/gyroscope/ Feedback: [email protected] with subject line “ [gyroscope] … message topic … ” ( archives ) Gyroscope Issues Repository Implementation Report: https://www.w3.org/wiki/DAS/Implementations Editor: Anssi Kostiainen ( Intel Corporation ) Former Editor: Mikhail Pozdnyakov ( Intel Corporation ) Test Suite: web-platform-tests on GitHub Copyright © 2026 World Wide Web Consortium . W3C ® liability , trademark and permissive document license rules apply. Abstract This specification defines a concrete sensor interface to monitor the rate of rotation around the device’s local three primary axes. Status of this document This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index. This document was published by the Devices and Sensors Working Group as a Candidate Recommendation Draft using the Recommendation track . This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to [email protected] ( subscribe , archives ). When sending e-mail, please put the text “gyroscope” in the subject, preferably like this: “[gyroscope] …summary of comment… ”. All comments are welcome. Publication as a Candidate Recommendation does not imply endorsement by W3C and its Members. A Candidate Recommendation Draft integrates changes from the previous Candidate Recommendation that the Working Group intend s to include in a subsequent Candidate Recommendation Snapshot. This is a draft document and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to cite this document as other than a work in progress. The entrance criteria for this document to enter the Proposed Recommendation stage is to have a minimum of two independent and interoperable user agents that implement all the features of this specification, which will be determined by passing the user agent tests defined in the test suite developed by the Working Group. The Working Group will prepare an implementation report to track progress. This document was produced by a group operating under the W3C Patent Policy . W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent that the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy . This document is governed by the 18 August 2025 W3C Process Document . This specification is maintained for existing deployments. Multiple browser engines have expressed concerns about this specification. For new projects, developers should use Device Orientation and Motion , which has cross-engine support. The Working Group intends to develop new motion-sensing functionality in Device Orientation and Motion . This document is maintained and updated at any time. Some parts of this document are work in progress. Table of Contents 1 Introduction 2 Use Cases and Requirements 3 Examples 4 Security and Privacy Considerations 5 Permissions Policy integration 6 Model 6.1 Reference Frame 7 API 7.1 The Gyroscope Interface 7.1.1 Gyroscope.x 7.1.2 Gyroscope.y 7.1.3 Gyroscope.z 8 Abstract Operations 8.1 Construct a Gyroscope object 9 Automation 10 Acknowledgements 11 Conformance Index Terms defined by this specification Terms defined by reference References Normative References Non-Normative References IDL Index 1. Introduction The Gyroscope API extends the Generic Sensor API [GENERIC-SENSOR] to provide information about the angular velocity around the device’s local X, Y and Z axis in terms of radian per seconds units. 2. Use Cases and Requirements The use cases and requirements are addressed in the Motion Sensors Explainer document. 3. Examples let sensor = new Gyroscope (); sensor . start (); sensor . onreading = () => { console . log ( "Angular velocity around the X-axis " + sensor . x ); console . log ( "Angular velocity around the Y-axis " + sensor . y ); console . log ( "Angular velocity around the Z-axis " + sensor . z ); }; sensor . onerror = event => console . log ( event . error . name , event . error . message ); 4. Security and Privacy Considerations Sensor readings provided by inertial sensors, such as gyroscope, could be used by adversaries to exploit various security threats, for example, keylogging , location tracking , fingerprinting , user identifying and even eavesdropping . Research papers published by security community, for instance, [KEYSTROKEDEFENSE] , indicate that by throttling the frequency, risks of successful attacks are not fully eliminated, while throttling may greatly affect usefulness of a web application with legitimate reasons to use the sensors. The [TOUCHSIGNATURES] research paper proposes that implementations can provide visual indication when inertial sensors are in use and/or require explicit user consent to access sensor readings . These mitigation strategies complement the generic mitigations defined in the Generic Sensor API [GENERIC-SENSOR] . 5. Permissions Policy integration This specification utilizes the policy-controlled feature identified by the string " gyroscope " defined in [DEVICE-ORIENTATION] . 6. Model The Gyroscope sensor type has the following associated data: Extension sensor interface Gyroscope Sensor permission names " gyroscope " Sensor feature names "gyroscope" Permission revocation algorithm Invoke the generic sensor permission revocation algorithm with " gyroscope ". Default sensor The device’s main gyroscope sensor. Virtual sensor type " gyroscope " A latest reading of a Sensor of Gyroscope sensor type includes three entries whose keys are "x", "y", "z" and whose values contain current angular velocity about the corresponding axes. The angular velocity is the rate at which the device rotates about a specified axis in a local coordinate system defined by the device. Its unit is the radian per second (rad/s) [SI] . The sign of the current angular velocity depends on the rotation direction and it must be according to the right-hand convention in a local coordinate system defined by the device, such that positive rotation around an axis is clockwise when viewed along the positive direction of the axis (see figure below). 6.1. Reference Frame The local coordinate system represents the reference frame for the Gyroscope readings . It can be either the device coordinate system or the screen coordinate system . 7. API 7.1. The Gyroscope Interface [ SecureContext , Exposed = Window ] interface Gyroscope : Sensor { constructor ( optional GyroscopeSensorOptions sensorOptions = {}); readonly attribute double ? x ; readonly attribute double ? y ; readonly attribute double ? z ; }; enum GyroscopeLocalCoordinateSystem { "device" , "screen" }; dictionary GyroscopeSensorOptions : SensorOptions { GyroscopeLocalCoordinateSystem referenceFrame = "device"; }; The new Gyroscope( sensorOptions ) constructor steps are to invoke the construct a gyroscope object abstract operation with this and sensorOptions . Supported sensor options for Gyroscope are "frequency" and "referenceFrame". 7.1.1. Gyroscope.x The x attribute of the Gyroscope interface represents the current angular velocity around X-axis. In other words, this attribute returns the result of invoking get value from latest reading with this and "x" as arguments. 7.1.2. Gyroscope.y The y attribute of the Gyroscope interface represents the current angular velocity around Y-axis. In other words, this attribute returns the result of invoking get value from latest reading with this and "y" as arguments. 7.1.3. Gyroscope.z The z attribute of the Gyroscope interface represents the current angular velocity around Z-axis. In other words, this attribute returns the result of invoking get value from latest reading with this and "z" as arguments. 8. Abstract Operations 8.1. Construct a Gyroscope object input object , a Gyroscope object. options , a GyroscopeSensorOptions object. Let allowed be the result of invoking check sensor policy-controlled features with object ’s sensor type . If allowed is false, then: Throw a SecurityError DOMException . Invoke initialize a sensor object with object and options . If options . referenceFrame is "screen", then: Set object ’s local coordinate system to the screen coordinate system . Otherwise, define object ’s local coordinate system to the device coordinate system . 9. Automation This section extends Generic Sensor API § 9 Automation by providing Gyroscope -specific virtual sensor metadata. The gyroscope virtual sensor type and its corresponding entry in the per-type virtual sensor metadata map are defined in Device Orientation and Motion § automation . 10. Acknowledgements Tobie Langel for the work on Generic Sensor API. 11. Conformance Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification. All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119] A conformant user agent must implement all the requirements listed in this specification that are applicable to user agents. The IDL fragments in this specification must be interpreted as required for conforming IDL fragments, as described in the Web IDL specification. [WEBIDL] Index Terms defined by this specification angular velocity , in § 6 conformant user agent , in § 11 Construct a Gyroscope object , in § 8 constructor() , in § 7.1 constructor(sensorOptions) , in § 7.1 "device" , in § 7.1 Gyroscope (interface) , in § 7.1 definition of , in § 6 Gyroscope() , in § 7.1 GyroscopeLocalCoordinateSystem , in § 7.1 Gyroscope(sensorOptions) , in § 7.1 GyroscopeSensorOptions , in § 7.1 referenceFrame , in § 7.1 "screen" , in § 7.1 x , in § 7.1 y , in § 7.1 z , in § 7.1 Terms defined by reference [ACCELEROMETER] defines the following terms: device coordinate system screen coordinate system [DEVICE-ORIENTATION] defines the following terms: "gyroscope" gyroscope virtual sensor type [GENERIC-SENSOR] defines the following terms: Sensor SensorOptions check sensor policy-controlled features default sensor eavesdropping extension sensor interface fingerprinting generic mitigations Generic Sensor permission revocation algorithm get value from latest reading initialize a sensor object keylogging latest reading local coordinate system location tracking per-type virtual sensor metadata sensor feature names sensor permission names sensor reading sensor type supported sensor options user identifying virtual sensor type [INFRA] defines the following terms: entry keys map values [PERMISSIONS] defines the following terms: permission revocation algorithm [PERMISSIONS-POLICY-1] defines the following terms: policy-controlled feature [WEBIDL] defines the following terms: DOMException Exposed SecureContext SecurityError double this throw References Normative References [ACCELEROMETER] Anssi Kostiainen. Accelerometer . URL: https://w3c.github.io/accelerometer/ [DEVICE-ORIENTATION] Reilly Grant; Marcos Caceres. Device Orientation and Motion . URL: https://w3c.github.io/deviceorientation/ [GENERIC-SENSOR] Rick Waldron. Generic Sensor API . URL: https://w3c.github.io/sensors/ [INFRA] Anne van Kesteren; Domenic Denicola. Infra Standard . Living Standard. URL: https://infra.spec.whatwg.org/ [PERMISSIONS] Marcos Caceres; Mike Taylor. Permissions . URL: https://w3c.github.io/permissions/ [PERMISSIONS-POLICY-1] Ian Clelland. Permissions Policy . URL: https://w3c.github.io/webappsec-permissions-policy/ [RFC2119] S. Bradner. Key words for use in RFCs to Indicate Requirement Levels . March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119 [WEBIDL] Edgar Chen; Timothy Gu. Web IDL Standard . Living Standard. URL: https://webidl.spec.whatwg.org/ Non-Normative References [KEYSTROKEDEFENSE] Song, Yihang, et al. Two novel defenses against motion-based keystroke inference attacks . 2014. Informational. URL: https://arxiv.org/abs/1410.7746 [SI] SI Brochure: The International System of Units (SI), 8th edition . 2014. 8th Edition. URL: http://www.bipm.org/en/publications/si-brochure/ [TOUCHSIGNATURES] Mehrnezhad, Maryam, et al. Touchsignatures: identification of user touch actions and pins based on mobile sensor data via javascript . 2016. Informational. URL: https://arxiv.org/abs/1602.04115 IDL Index [ SecureContext , Exposed = Window ] interface Gyroscope : Sensor { constructor ( optional GyroscopeSensorOptions sensorOptions = {}); readonly attribute double ? x ; readonly attribute double ? y ; readonly attribute double ? z ; }; enum GyroscopeLocalCoordinateSystem { "device" , "screen" }; dictionary GyroscopeSensorOptions : SensorOptions { GyroscopeLocalCoordinateSystem referenceFrame = "device"; }; ⚠ MDN Gyroscope/Gyroscope In only one current engine. Firefox None Safari None Chrome 67+ Opera ? Edge 79+ Edge (Legacy) ? IE None Firefox for Android ? iOS Safari ? Chrome for Android ? Android WebView ? Samsung Internet ? Opera Mobile ? ⚠ MDN Gyroscope/x In only one current engine. Firefox None Safari None Chrome 67+ Opera ? Edge 79+ Edge (Legacy) ? IE None Firefox for Android ? iOS Safari ? Chrome for Android ? Android WebView ? Samsung Internet ? Opera Mobile ? ⚠ MDN Gyroscope/y In only one current engine. Firefox None Safari None Chrome 67+ Opera ? Edge 79+ Edge (Legacy) ? IE None Firefox for Android ? iOS Safari ? Chrome for Android ? Android WebView ? Samsung Internet ? Opera Mobile ? ⚠ MDN Gyroscope/z In only one current engine. Firefox None Safari None Chrome 67+ Opera ? Edge 79+ Edge (Legacy) ? IE None Firefox for Android ? iOS Safari ? Chrome for Android ? Android WebView ? Samsung Internet ? Opera Mobile ? ⚠ MDN Gyroscope In only one current engine. Firefox None Safari None Chrome 67+ Opera ? Edge 79+ Edge (Legacy) ? IE None Firefox for Android ? iOS Safari ? Chrome for Android ? Android WebView ? Samsung Internet ? Opera Mobile ? ⚠ MDN Headers/Feature-Policy/gyroscope In only one current engine. Firefox None Safari None Chrome 67+ Opera ? Edge 79+ Edge (Legacy) ? IE None Firefox for Android ? iOS Safari ? Chrome for Android ? Android WebView ? Samsung Internet ? Opera Mobile ?

Related documents

Record · ID 182914 · SHA-256 505b0d72df3d5459
Conceptio Open Knowledge Archive — every document is proof-bundled with source, license, and retrieval metadata.