If you use the Google Lighthouse system, you can easily detect geolocation permission requests that appear during page loading. The system notices this and presents it as a warning and flags it. Here is an example:
geolocation.watchPosition() snippets. If the permission is not granted yet, the audit process will fail.
If permission is given before performing the audit, Lighthouse may not work properly. For this reason, before starting the audit, you should definitely do a reset to cancel the previously given permissions.
How to ask users’ locations as UX compatible?
Make sure 100 percent that there are no codes
geolocation.watchPosition() in Page load. Later,
- Issue geolocation permission after user action is completed.
- Note also that users may not want to give you this information.
- If you can’t get geolocation permission, use a fallback.
- If a transaction requires geolocation, make sure to specify this in advance.
Test Your Website Issues
You can quickly analyze your site