Geolocation Popup

Hi,
I’m building a website that would need user’s geolocation in order to calculate shipping time based on where they are. It looks like the getcurrentgeolocation() will only work when user allow access on the popup screen.
In case a user doesn’t allow the access at first, and then wants to give the permission later to see the shipping time, is there any way that we can show that pop up window again and enable to geolocation access?

Thanks for your help!

Have you tried just adding it in as a user input like as shown here.
https://www.wix.com/corvid/forum/tips-tutorials-examples/how-to-use-google-maps-services-in-wix-code

Plus, as you have stated and as mentioned in the Wix API Reference,
https://www.wix.com/corvid/reference/wix-window.html#getCurrentGeolocation

Note
The getCurrentGeolocation() function has the following limitiations:

  • On Chrome, the function only works on HTTPS sites.

  • On Chrome, Firefox, and Safari, the function only works if the user approves a popup.

So, if they didn’t allow it first time and closed the popup, with your additional user input here asking for it, the popup should reappear (hopefully) and they can accept it this time around.

You might want to look at seeing if you can capture the current users geolocation when the user first comes onto your site or onto a certain page and then store in it Wix Storage for example.

Then, when you come to need it for calculating shipping you can check Wix Storage to see if you already have it and if you do then keep this ssecond user input hidden, if you don’t then simply have the second user input shown asking for it.