«   Previous tip Next tip   »

Chrome DevTools: Use the Sensors Pane to control specific device sensors

Last updated: 12th December 2020
Use the Sensors Pane to control specific device sensors


DevTools has received some updated UI and controls for device sensors. You can control Location, Orientation, Touch and Idleness.

How to use this feature

You can control geolocation by specifying a latitude/longitude, or even using some presets such as London or Tokyo.

You can also control device orientation (alpha, beta, gamma) with some included presets like portrait, landscape, 'display down' and others.

There is also a control for device-based or force enabled touch.

Bonus: JavaScript

We just discussed overriding the geolocation and device orientation using the Sensors Panel. Here's the code to monitor the two:

You can use this piece of JavaScript to retrieve geolocation information:

navigator.geolocation.getCurrentPosition(pos => console.log(pos.coords));

You can use this piece of JavaScript code to observe for orientation changes:

window.addEventListener("deviceorientation", evt => console.log(evt), true);


Overriding such device and/or environment characteristics can be useful for getting closer to what your users experience. The sensors mentioned above are a good start, there is also:

«   Previous tip Next tip   »

Sign up to receive a developer tip, in the form of a gif, in your inbox each week