getCurrentGeolocation( )


Gets the current geolocation of a site visitor.

The getCurrentGeolocation() method has the following limitations:

  • On Chrome, the function only works on HTTPS sites.
  • On Chrome, Firefox, and Safari, the function only works if the site visitor approves a popup. If they do not approve, the promise is rejected.
  • Run getCurrentGeolocation() with a setTimeout() in case the browser is set to not detect the locale. Adding the timeout lets you handle the unfulfilled promise.
Method Declaration
Copy
Request
This method does not take any parameters
Returns
Return Type:Promise<CurrentGeolocation>
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?