Overview Open Chrome DevTools What's New In DevTools DevTools Engineering Get Started With Viewing And Changing The DOM Find Unused JavaScript And CSS With The Coverage Tab Find and fix problems with the Issues tab Run commands in the Command Menu View and debug media players information Emulate authenticators and debug WebAuthn Edit files with Workspaces Debug Progressive Web Apps Understand security issues Keyboard shortcuts View page resources
Overview Open Chrome DevTools What's New In DevTools DevTools Engineering Get Started With Viewing And Changing The DOM Find Unused JavaScript And CSS With The Coverage Tab Find and fix problems with the Issues tab Run commands in the Command Menu View and debug media players information Emulate authenticators and debug WebAuthn Edit files with Workspaces Debug Progressive Web Apps Understand security issues Keyboard shortcuts View page resources

Override geolocation

Published on

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

Last updated: Improve article

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.