mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

GeolocateControl Spins forever on Chrome for iOS

Open chriswhong opened this issue 2 years ago • 10 comments

It looks like the geolocateControl is not working on Chrome for iOS. I have confirmed:

  • Chrome has permission to use location services "while using the app"
  • Location is available in other websites after granting permission (Use browerleaks.com/geo
  • The mapbox-gl-js site(s) in question have been granted permission to use location the first time they were loaded

mapbox-gl-js version: 2.11.0

browser: Chrome 109.0.5414.83 on iOS 16.1.1

Steps to Trigger Behavior

  1. Open chrome, load a mapbox gl js map with geolocate control (e.g. https://docs.mapbox.com/mapbox-gl-js/example/locate-user/)
  2. Tap the geolocate control
  3. The control shows a spinning icon, but never gets the location.

Expected Behavior

The geolocate control gets a location and mapbox gl js shows the blue puck on the map

Actual Behavior

The geolocate control spins forever

chriswhong avatar Jan 20 '23 14:01 chriswhong

I can confirm this issue. It might be related to Chrome on iOS — I can't get a location with Chrome 109.0.5414.112 on iOS 16.2 in https://browserleaks.com/geo even after I confirm the permission request prompt.

stepankuzmin avatar Jan 26 '23 15:01 stepankuzmin

Likely related to Chrome, as it works on Firefox for iOS version 109 on iOS 15.6.1.

Countdown369 avatar Jan 26 '23 21:01 Countdown369

I have the problem on Firefox version 109 except with iOS version 16.0. Upgraded to 16.3 and same thing

mazurbeam avatar Jan 30 '23 19:01 mazurbeam

Seems to be experiencing the same issue on two different iOS phones

lukedupin avatar Apr 08 '23 16:04 lukedupin

Hi @lukedupin, on which iOS versions does it reproduces for you?

stepankuzmin avatar Apr 17 '23 15:04 stepankuzmin

I can also confirm that geolocateControl doesn't work on Chrome or Safari for iOS 16.5 but it works for Chrome and Safari for iOS 15.7.6

hadminh avatar May 25 '23 05:05 hadminh

Commenting for support - iOS 16.2 running Chrome 113.0.5672.121. Geo locate control spins forever. Hope someone can investigate this

olinoles avatar May 29 '23 08:05 olinoles

This is a weird one. I am happy to tell you that the issue is gone with the just released iOS 16.5

hanqvist avatar May 31 '23 13:05 hanqvist

I'm running into this same issue 😔

Unfortunate that it's 2 years later and this is still an issue. @stepankuzmin any thoughts on how we can get this fixed. I just spent the weekend migrating our Leaflet integration to using Mapbox and I can't use this if Chrome does not work correctly.

Any thoughts on this? Really concerned now that migrating might have been a bad choice if this is causing an issue.

Everything works for chrome desktop, but on Chrome for Ios, I get the never-ending geolocation spinner that never resolves.

Let me know if there's anything I can do to help resolve this bug.

tnylea avatar Oct 20 '25 00:10 tnylea

Ok @stepankuzmin, I got this resolved... Kind of. What I had to do was to Go into the Chrome Settings -> Location and then toggle the Location Access and Precise Location toggle.

Image

After doing that, it seemed to work. I'm not sure what the issue was before, but it would be nice if Mapbox had a timeout when the user clicks the UserLocation button. You could even say after 30 seconds of that control spinning, you alert a message to the user and say, please toggle your location access or make sure that you've allowed Location Access in your browser settings.

Hope this can help someone else out down the road. I had a mini panic-attack when I thought that all the work I had done this weekend was pointless 🤪

Really loving Mapbox though and I appreciate y'alls hard work on this awesome library.

tnylea avatar Oct 20 '25 16:10 tnylea