Testing location-based functionality is crucial for modern web applications, particularly in the modern age, where site visitors can come from any part of the globe.
I recently ran into a timezone issue on my companies website, where users weren't able to select a valid datetime to schedule a meeting from a dropdown. As it turns out, they were in a timezone where the only available times were the following day (for them), previous day for the other party.
But I was only able to see that error once I spoofed my location and ran through the same test case. So in this article I'll break down the many ways that you can test your apps from different parts of the world, without leaving your seat.
Chrome provides built-in location spoofing through Developer Tools:
- Open Chrome DevTools (F12 or Ctrl/Cmd + Shift + I)
- Click the three-dot menu → More tools → Sensors
- In the Location section, select a preset location or enter custom coordinates
- Refresh your page to apply the new location

The "Sensors" panel should look like the following:

You can select from a predetermined dropdown list, or add your own custom geolocation coordinates.
Programmatic approach:
// Override geolocation in Chrome DevTools Console
navigator.geolocation.getCurrentPosition = function(success) {
success({
coords: {
latitude: 37.7749, // San Francisco
longitude: -122.4194,
accuracy: 10
}
});
};
Firefox offers similar functionality, but takes a slightly different approach.
Type about:config
in the address bar.
Search for geo.provider.network.url
and change it to a custom URL that returns the coordinates you want (more hacky).
You'll notice that by default, Firefox uses a googleapis api endpoint for its geolocation services.
If you want to spoof location in Firefox by editing geo.provider.network.url
, you’d need to point it to a different service (or your own server) that always returns the coordinates you want.
If you just put in your own Google API key in the default service URL, you could control billing/limits, but you’d still be sending actual network info to Google unless you intercept and modify the request.
To truly fake it, you’d run a local HTTP server that returns a fixed JSON payload like:
{
"location": {
"lat": 48.8566,
"lng": 2.3522
},
"accuracy": 50
}
Method 2: Browser Extensions
If you are looking to simplify things a bit, you can use one of the many browser extensions that let you easily update your geolocation with just a few clicks:
Popular Location-Spoofing Extensions
Location Guard (Chrome/Firefox)
- Provides location privacy with customizable accuracy levels
- Useful for testing various location precision scenarios
- Free and open-source
Extension Benefits
- No need to modify code
- Easy switching between locations
- Persistent across browser sessions
- Works with any website
Troubleshooting
HTTPS Requirements
Modern browsers require HTTPS for geolocation APIs. For local development:
// Check if geolocation is available
if (!navigator.geolocation) {
console.error('Geolocation is not supported or requires HTTPS');
}
Mixed Location Sources
Applications often use multiple location detection methods:
- Browser geolocation API (GPS/WiFi-based)
- IP geolocation (server-side)
- User-selected location (manual input)
Test each method independently and ensure consistent behavior.
Caching Issues
Location data is often cached. Clear browser data between tests:
# Clear Chrome cache and data for testing
rm -rf ~/Library/Application\ Support/Google/Chrome/Default/Local\ Storage
A few use cases
Location-based testing helps verify several critical aspects of your application:
- Geo-blocking and content restrictions - Ensure content shows correctly based on regional availability
- Localization and internationalization - Test language, currency, and regional content variations
- Location-based features - Validate maps, store locators, and proximity-based functionality
- Performance optimization - Test CDN routing and regional server responses
- Compliance requirements - Verify GDPR, data residency, and regional regulation adherence (more important in 2025)
Conclusion
Effective location testing requires a multi-layered approach combining browser tools, extensions, automated testing frameworks, and API mocking. Choose the methods that best fit your development workflow and testing requirements.
Remember to test not just the happy path but also error conditions, permission denials, and edge cases. This comprehensive approach ensures your location-based features work reliably for users worldwide.
Walt is a computer scientist, software engineer, startup founder and previous mentor for a coding bootcamp. He has been creating software for the past 20 years.