0

For my website, I want to ask the user for their exact location in the form of "[Website] wants to know your location" popup in javascript, with the block and allow options. It works perfectly fine on Chrome on MacOS, but when I switch to Chrome for iOS, it does not work. I use this command:

navigator.permissions && navigator.permissions.query({name: 'geolocation'})
            .then((permissionStatus) => {....

After doing some research, I found from Mozilla geolocation API docs that it supports this feature for Chrome on Android among a couple others:

browser_support

My question is, are there APIs similar to this geolocation API that support Chrome on iOS? Or any method at all for that matter. Thanks.

Kevin Sun
  • 163
  • 2
  • 10
  • [This](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API/Using_the_Geolocation_API) prompts me for location in both Safari and Chrome on iOS. Note that you first have to allow Chrome to use your location and then allow the web site to use your location. If you have denied location access to Chrome then you won't even get a promp to let the website have your location; it just fails – Paulw11 Aug 30 '21 at 07:00
  • Thanks @Paulw11. I double checked to make sure, and I do have location services turned on. However, while I can't get it to work for chrome on iOS, I can still get it to work on safari on iOS. – Kevin Sun Aug 30 '21 at 23:28
  • Double check the settings for the Chrome app in settings on your iOS device - If you have declined location access there you won't even see a prompt in the app. As I said, the page I linked to works for me on my iPhone in both Safari and Chrome; Safari prompts once, Chrome prompts twice (at least initially) – Paulw11 Aug 31 '21 at 00:10
  • Chrome on iOS is just a wrapper around Safari so as long as the chrome app has the location permission the javascript will work identically – Paulw11 Aug 31 '21 at 00:21

0 Answers0