Geolocation Issue PWA

I am having an issue with an app i intend to run in the browser that uses geolocation.

Starting from a Home page, the user can navigate to a map page that displays a map. There is a “Geolocate” button, that should get the user’s geolocation and add a marker to the map.

Everything works fine in the browser. On iOS (safari and chrome) after navigating to the map page and clicking the “Geolocate” button, the navigator.geolocation.getCurrentPosition() method and Geolocation.getCurrentPosition(), return an error (POSITION_UNAVAILABLE)

When the map page is refreshed or entered directly via url everything works fine.

This makes me think that the navigation somehow affects the navigator.geolocation service. ¿any ideas?

Thanks in advance