Reputation: 53
I successfully used map.locate() in my app. Now I would like to customize the default popup of the browser, specifically sending my own message explaining to the user why the site is asking the permission to get the position. I would like to avoid using another popup before asking the locate to explain that.
I didn't see that kind of setting in the API doc, Is it possible to pass a custom message? thanks
Upvotes: 0
Views: 328
Reputation: 28678
As you said yourself, this message isn't coming from Mapbox, or Leaflet but straight from the browser. From the navigator.geolocation
API to be specific. The docs for the API (on MDN) state:
Note: For security reasons, when a web page tries to access location information, the user is notified and asked to grant permission. Be aware that each browser has its own policies and methods for requesting this permission.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/geolocation
I'm fairly sure no browser will let you change their dialog. Securitywise it's best to be consistent towards users, so that everytime they get a dialog it looks familiar to them. Styling or changing the content of a dialog is confusing. If you want supply extra info about why you use geolocation you'll need to find another way to relay it towards your users.
Upvotes: 1