Two kinds of location#
| Location source | Read by | Changed by DevTools Sensors or Playwright geolocation |
|---|---|---|
Geolocation API (navigator.geolocation) | Page scripts, after the user grants permission | Yes |
| The client's IP address | Servers, CDNs, consent tools, payment and ad scripts | No |
| Locale and time zone | Page scripts, and the server through Accept-Language | No, but they can be set separately |
| The account's country setting | The application | No: it is data |
Playwright's geolocation option, used with the geolocation permission, sets the coordinates the page receives. Codegen's --geolocation does the same. Playwright: Geolocation
Find which one the bug depends on#
Look at the request and response, not only the page.
- The response differs by country. A CDN or edge rule adds a header such as a country code, a redirect to a country site, or a different price list. Compare the reporter's document response headers with yours.
- A third-party script behaves differently. Consent banners, payment methods and tax calculation often depend on the visitor's IP country. The script's own requests in the Network panel show what it decided.
- The page asks for coordinates. A store locator or a delivery-area check that calls
navigator.geolocation. Emulating coordinates reproduces this one. - The locale is what differs. Users in one country share a language and time zone. Often the "country bug" is a locale bug.
Reproduce an IP-based decision#
You cannot change your IP's country with a browser setting. Options, from cheapest:
- Ask the server which country it saw. If the CDN sets a country request header for the origin, log it, or have a debug endpoint return it.
- Override it in a non-production environment, such as a query parameter or a header the edge honors in staging only.
- Replay the response. If the bug is in how the page handles a country-specific response, record that response and serve it back.
- Test from that region with infrastructure your organization already has there, such as a CI runner or a cloud VM in that region.
Record the country the server saw, not only the country the user was in. VPNs, corporate proxies and mobile carriers often route traffic through another country.
Worked example: a payment option missing in Austria#
This example is fictional. Users in Austria report that the "Pay by invoice" option is missing. A developer in Germany emulates Vienna's coordinates with DevTools Sensors and still sees the option.
The Austrian user's Network panel shows the payment provider's configuration request returning methods without invoice, and its response includes "country": "AT", derived from the IP address. The geolocation emulation never reached that request. The developer replayed the provider's Austrian response with routeFromHAR and saw the missing option; the provider's dashboard showed invoice payments enabled only for Germany. A configuration change fixed it.
Questions#
Does the Sensors panel change the time zone too?
The Sensors panel has separate settings for the location, the time zone and the locale. Set each to match the reporter, since a preset city does not imply them.
Is a VPN a valid way to reproduce?
It can be, if your organization permits it, and it does change the IP country. Record the exit country and treat it as an approximation: some services detect VPN addresses and treat them differently.
Is the user's country personal data?
On its own it is coarse. Combined with other details it narrows down a person. Record what the reproduction needs.
Return to reproducing what someone else saw for the other layers a replay needs.