0

I would like to get location from user, but I think that the default message is a bit scary.

geolocation in chrome

How would you explain the reason why you need it?

Usually you need it to give the user a better experience, but most times I decline that request.

I've been thinking...

1) You can't customize the default message, and you can't even add some additional explanation either, I'm afraid.

2) You could display a message next to the default popup, but every browser displays different popups in different places, and I think there's no way to know that this popup is being displayed anyway.

3) You could display a message before getting the location, but I think there's no compatible way to tell if location was granted before actually asking for it.

So... any advice here?

Thank you!

Community
  • 1
  • 1
Ferran Maylinch
  • 10,919
  • 16
  • 85
  • 100

1 Answers1

1

I think your option 3 is the best.

There is a way for the website to know if the location has been granted or not (because you could need different interfaces for each scenario). https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation

Telling the user that you're going to need his permision to use location (and why) is the best way to ensure they will see it (sometimes user's don't even see these little popups) and accept it.

I saw a website (can't remeber now which one) that even had a little arrow poiting to the top left corner of the window telling the user "this is where you need to accept the request for your location"

Ivo Gomes
  • 11
  • 1