Have questions about images on the web? Tweet your questions to @ChromiumDev with #AskChrome and we'll answer the top questions in our next #AskChrome episode on YouTube.

Emulate Sensors: Geolocation and Accelerometer

GPS chips and accelerometers can be difficult to test since most desktops don't have them. The Chrome DevTools Sensors emulation pane reduces the overhead of testing by emulating common mobile device sensors.

TL;DR

  • Emulate geolocation coordinates to test geolocation overrides.
  • Simulate device orientation to test accelerometer data.

Access sensor controls

To access the Chrome DevTools sensor controls:

  1. Open the DevTools main menu, then
  2. Under More Tools, click on Sensors
Navigate to Sensors panel

Override geolocation data

Unlike desktops, mobile devices commonly use GPS hardware to detect location. In the Sensors pane, you can simulate geolocation coordinates to use with the Geolocation API.

Enable the geolocation emulation by selecting the Emulate geolocation coordinates checkbox in the sensors pane of the emulation drawer.

geolocation emulator enabled

You can use this emulator to override position values for navigator.geolocation, as well as to simulate cases when geolocation data is unavailable.

Emulate Accelerometer (Device Orientation)

To test accelerometer data coming from the Orientation API, enable the accelerometer emulator by selecting the Accelerometer checkbox in the Sensors pane.

Accelerometer control

You can manipulate the following orientation parameters:

α
Rotation around the z-axis.
β
Left-to-right tilt.
γ
Front-to-back tilt.

You can also click and drag the model accelerometer to the desired orientation.

Try out the accelerometer emulator using this device orientation demo.

Feedback

Was this page helpful?
Yes
What was the best thing about this page?
It helped me complete my goal(s)
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had the information I needed
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had accurate information
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was easy to read
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Something else
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
No
What was the worst thing about this page?
It didn't help me complete my goal(s)
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was missing information I needed
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It had inaccurate information
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
It was hard to read
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Something else
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.