1. Getting Started
  2. Installation: Preline UI


Avoids requesting the geolocation permission on page load

Users are mistrustful of or confused by pages that automatically request their location on page load.

How the Lighthouse geolocation audit fails

Sitefig flags pages that request geolocation permission on load

Sitefig checks all JavaScript executed on page load. If the code calls geolocation.getCurrentPosition() or geolocation.watchPosition(), and geolocation permission has not already been granted, the audit fails.

If geolocation permission was granted to a page before the audit, Lighthouse can't identify any geolocation permission requests. So, make sure to reset permissions before running the audit.

Lighthouse reports the URL and line number of each request for geolocation permission.

Each Best Practices audit is weighted equally in the Lighthouse Best Practices Score. Learn more in The Best Practices score.

How to ask for users' locations responsibly

Remove all calls to geolocation.getCurrentPosition() and geolocation.watchPosition() that occur on page load.

To provide a better user experience:

  • Always request geolocation permission after a user action, not on page load.
  • Clearly indicate that the action will request geolocation permission.
  • Assume users won't give you their locations.
  • Use a fallback if users don't grant geolocation permission.

All rights reserved - Sitefig