Missed the action at the 2018 Chrome Dev Summit? Catch up with our playlist on the Google Chrome Developers channel on YouTube. Watch now.

Override Geolocation With Chrome DevTools

Many websites take advantage of user location in order to provide a more relevant experience for their users. For example, a weather website might show the local forecast for a user's area, once the user has granted the website permission to access their location.

If you're building a UI that changes depending on where the user is located, you probably want to make sure that the site behaves correctly in different places around the world. To override your geolocation in Chrome DevTools:

  1. Press Command+Shift+P (Mac) or Control+Shift+P (Windows, Linux, Chrome OS) to open the Command Menu.

    The Command Menu.
    Figure 1. The Command Menu

  2. Type sensors, select Show Sensors, and press Enter. The Sensors tab opens up at the bottom of your DevTools window.

  3. From the Geolocation list select one of the preset cities, like Tokyo, or select Custom location to enter custom longitude and latitude coordinates, or select Location unavailable to see how your site behaves when the user's location is not available.

    Selecting 'Tokyo' from the 'Geolocation' list.
    Figure 2. Selecting Tokyo from the Geolocation list

Feedback

Was this page helpful?