Chrome DevTools: Use the Sensors Pane to control specific device sensorsLast updated: 12th December 2020
DevTools has received some updated UI and controls for device sensors. You can control Location, Orientation, Touch and Idleness.
How to use this feature
- Open the Sensors Pane using the Command Menu (Cmd + Shift + P).
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.
We just discussed overriding the geolocation and device orientation using the Sensors Panel. Here's the code to monitor the two:
navigator.geolocation.getCurrentPosition(pos => console.log(pos.coords));
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: