Geolocation is super useful feature in our apps. It doesn't matter if you want to find a way in a new city or just order food to home - you can just click one button and avoid typing a long address. As developers we know a lot of ways to implement location in web — but how can we test if it works properly? The answer is: just use your browser. How to do that?
- Open the Chrome browser
- Go to page you want to test
- Open Chrome DevTools (ctrl + shift + I on Linux/Windows or cmd + shift + I on Mac)
- Click 3 dots on the right side.
- Choose More Tools and Sensors
- Check Geolocation section
As you can see you have a lot of options available here. You can choose one of the default places defined in the dropdown menu (like London, Berlin, or Shanghai) or define your own latitude and longitude. When you often use some location that is not available by default you can click Manage and Add location to add your custom place to presets. You can also check how your webpage behaves when some errors occurred and data are unavailable — it’s enough to choose the Location unavailable option from the menu. Voila! It just works! You don’t need to drive around the city with a laptop on your knees or install some third-party software. Quite nice — don’t you think?
Top comments (0)