brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: the DevTools Sensors panel fakes your location for testing

Devtools
~/tips/tip-devtools-sensors-location

type "sensors" > Show Sensors > Geolocation

Test location based features as if you were somewhere else.

A store finder is hard to test from your desk, because your desk does not move. DevTools can tell the page you are on the other side of the world.

Open the command menu with Ctrl+Shift+P (Cmd+Shift+P on a Mac), then:

type "sensors" > Show Sensors > Geolocation

Pick a preset city such as Tokyo, or choose a custom location and enter your own latitude and longitude. Reload or press the button on your page that asks for the position, and it receives the fake coordinates. In the console you can check it:

navigator.geolocation.getCurrentPosition(p =>
  console.log(p.coords.latitude, p.coords.longitude))

The option I like most is Location unavailable. It shows what your page does when no position can be found, a path that rarely gets tested and often leaves a spinner turning forever.

The browser still asks for permission as usual. The override only changes what this API reports: a server that guesses your country from your IP address sees the same address as before. Set it back to no override when you finish, or maps will keep insisting you are abroad.

Further reading: Chrome DevTools: emulate sensors

More Devtools tips Clear site data for one site from Chrome DevTools user.id === 42 $x(path [, startNode]) @media (prefers-color-scheme: dark) { queryObjects(Promise) All Devtools tips (22) All topics

Link