Chrome DevTools can make a website behave as if the browser is in a different place, so you can check location-based content without travelling. You can set a preset or custom latitude and longitude, grant or deny location access, and verify how the page responds.
What You’ll Need
- Google Chrome on a computer, with the website or local development page you want to test.
- A page that requests location through the browser’s Geolocation API, or another location-dependent feature to check.
- Coordinates for any custom test location. Latitude ranges from -90 to 90; longitude ranges from -180 to 180.
Step-by-Step
- Open the page you want to test. Use the same page and browser context you expect visitors to use. Location emulation changes the environment for the current tab; it does not change your computer’s actual location or affect other browsers.
- Open DevTools. Press F12 or Ctrl+Shift+I on Windows or Linux. On macOS, press Command+Option+I. You can also right-click the page, choose Inspect, and open DevTools.
- Open the Sensors tool. In DevTools, select the three-dot menu, then More tools > Sensors. If Sensors is already available as a tab or drawer, select it. The tool may open in the bottom drawer; widen the drawer if its controls are hard to see.
- Choose a location. In Sensors, find the Location control. Select a preset location if one suits your test. To enter a specific point, choose the custom-location option (shown as Other… in some Chrome versions) and enter latitude and longitude in decimal degrees. For example, a point could be written as latitude 37.7749 and longitude -122.4194. Use a minus sign for south latitudes or west longitudes. Check that the values are within their valid ranges.
- Reload the page. Refresh the tab after setting the location, especially if the page checks location during startup. Keep DevTools open while testing. A site may not request location until you press a button or complete an action, so trigger that feature if needed.
- Allow location access when prompted. If Chrome displays a permission prompt, choose Allow to test the success path. The page should receive the emulated coordinates if it requests location through the browser API. Check the displayed location or map marker against the coordinates you entered.
- Test a denied-permission case. Open the site information control beside the address bar, open Site settings, and set Location to Block. Reload the page and try its location feature again. A well-handled page should explain that access was denied or offer a way to continue without location. Restore the permission when finished.
- Test other outcomes if relevant. In Sensors, Chrome may offer location states such as unavailable or permission denied, in addition to presets and custom coordinates. Use the options shown in your version to test how the page handles failure. You can also try a point far from your normal location to check regional content. Reload or repeat the location request between tests.
- Restore normal testing conditions. Set Location back to the default or clear the emulation, and return the site’s Location permission to its previous setting. Reload the page once more. This helps prevent a later test from accidentally using the simulated location or a blocked permission.
Common Mistakes
- Expecting a location change to update a page automatically. Emulation supplies a location when the page requests it; it does not guarantee that an already-loaded page will rerun its code. Reload or trigger the feature again.
- Mixing up latitude and longitude. Enter latitude first and longitude second. Reversing them can produce the wrong place or coordinates outside valid ranges.
- Testing only the allowed case. Real visitors may deny permission, have location unavailable, or encounter an error. Test these paths as well as a successful location request.
- Confusing browser permission with an operating-system setting. A site can be allowed in Chrome but still fail to obtain a location if the computer’s location service is unavailable or disabled.
- Assuming every location feature uses browser geolocation. A site might use an account address, IP-based estimate, or another source. DevTools location emulation may not change those results.
Tips
- Keep a small test list: a normal location, a distant location, permission denied, and location unavailable. Record what the page should show for each one.
- Use decimal degrees for custom coordinates. Negative values indicate south for latitude and west for longitude.
- Watch the DevTools Console for permission or geolocation errors, and check the Network panel if the page sends the coordinates to a service. Avoid sharing real user coordinates in logs or screenshots.
- Test at the viewport sizes your site supports. Location behavior is emulated, but responsive layout and map presentation can still vary with screen size.
- Do not treat an emulated result as proof of a visitor’s real-world position. It is a development aid for checking application behavior.
Troubleshooting
- There is no Sensors option. Open DevTools’ three-dot menu and look under More tools. If you do not see it, check that DevTools is open for the tab you are testing, then close and reopen DevTools. Chrome’s menu arrangement can differ between releases.
- The page still shows your usual location. Confirm that a preset or custom location is selected in Sensors, then reload and request location again. Check whether the page uses an IP address, saved profile address, or a third-party service instead of browser geolocation.
- The browser never asks for permission. The page may not request location until you use a particular control. Also check the site information control beside the address bar: a saved Allow or Block choice can prevent a new prompt. Review Site settings and reset or change Location for the test.
- The request fails even after allowing it. Make sure the page is served from a secure context, such as HTTPS or localhost; browser geolocation is generally restricted on insecure pages. Check the Console for the specific error, and confirm that the operating system permits Chrome to use location services if required.
- Coordinates look wrong. Verify latitude and longitude order, signs, and ranges. Check the site’s map or output against the exact decimal values entered, rather than relying only on a rounded city label.
- The test remains blocked after you finish. Return to the site’s Location setting and change it from Block to Ask (or its previous choice). Clear the Sensors override and reload. Permission controls are per site, so restoring one page does not necessarily change another site’s setting.
Frequently Asked Questions
Does DevTools change my computer’s real location?
No. Sensors emulates location for the page being tested; it does not move or alter the device’s actual location.
Can I enter any location?
You can enter valid latitude and longitude coordinates within -90 to 90 and -180 to 180. Whether the page can display that point depends on its own features and data.
Do I need to reload after changing the location?
Often, yes. Reloading makes the page rerun code that requests location on startup. If it requests location only after a user action, repeat that action too.
Can I test a user denying permission?
Yes. Set the site’s Location permission to Block in Site settings and reload, or use a denied or unavailable state if Sensors offers one in your Chrome version.
Why does a location-based website ignore the emulated coordinates?
It may use IP-based location, an account address, cached data, or a location service outside the browser Geolocation API. DevTools emulation does not override every source of location information.
Will the emulated location stay active?
It can remain in effect while the override is selected. Clear or reset the Sensors location and reload when you want to return to normal conditions.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- ViewSonic Driver: Find & Install the Right One
- iPhone Camera Won’t Focus? Fix It in 8 Steps
- iPhone Data Recovery: How to Install and Use It
- How to Refill Your Transit Card in Apple Maps
- How to Recover WhatsApp Messages from Android
- How to Unlock Phone When Forgot Password