Many modern websites use the HTML5 Geolocation API to serve localized content, such as nearby restaurant recommendations or regional news. If you are a web developer building a location-aware application, you need to test how your site behaves for users in different cities or countries. Rather than physically traveling or paying for an expensive VPN service, you can use the Google Chrome DevTools “Sensors” tab to easily spoof your GPS coordinates.
Why Spoof Your Location?
Location spoofing allows you to artificially inject latitude and longitude coordinates directly into the browser’s Geolocation API. When your web application asks the browser “Where are you?”, Chrome will return your fake coordinates instead of your actual physical location. This is crucial for verifying internationalization layouts, region-locked features, and local timezone handling.
Step 1: Open the Sensors Tab
The Sensors tool is located in the DevTools Drawer panel.
- Open Google Chrome and navigate to the website you want to test.
- Right-click anywhere on the page and select Inspect to open Chrome Developer Tools.
- Press the Esc key to open the “Drawer” at the bottom of the DevTools window.
- In the top-left corner of the Drawer, click the three vertical dots (More Tools icon).
- Select Sensors from the drop-down menu.
Step 2: Override the Location
Once the Sensors tab is open, you can configure your fake coordinates.
- Look for the Location section at the top of the Sensors tab.
- By default, the drop-down menu is set to “No override”. Click the menu to expand it.
- Chrome provides several built-in presets (e.g., Tokyo, London, San Francisco). Select one of these cities to instantly jump to that location.
- To enter a specific location, select Other… from the drop-down menu.
- Enter your desired Latitude and Longitude into the input boxes. You can easily find these coordinates using Google Maps.
Step 3: Test the Geolocation Behavior
Now you must trigger the site’s location request.
- Refresh the web page so the site re-initializes its scripts.
- If the website prompts you for location permission (a pop-up asking to “Know your location”), click Allow.
- The website will process the request and serve content based entirely on the spoofed coordinates you entered in the Sensors tab.
By utilizing the Chrome DevTools Sensors tab, developers can rigorously test location-based logic and regional formatting without ever leaving their desk.