0

I have a compass web app which points to the clients store location, and I want to get the users geolocation permission so I can use the two locations.

I found this code in the internet, but it doesn't work in mobile browser

navigator.permissions.query({ name: 'geolocation' }).then(function(result) {
    /* result.status = "prompt" */
});


navigator.geolocation.getCurrentPosition(function(result) { /* ... */  })

navigator.permissions.query({ name: 'geolocation' }).then(function(result) {
    /* result.status = "granted" */
});

navigator.permissions.query({ name: 'push', userVisibleOnly:true }).then(function(result) { /* ... */ });
Eddie
  • 26,593
  • 6
  • 36
  • 58

1 Answers1

0

Your browser must support this feature

If you browser isn't exist in this list, that's mean you can't use geolocation:

https://caniuse.com/#feat=geolocation

As we see, you need use:

  • Opera Mobile
  • Chrome for Android
  • Firefox for Android
  • IE Mobile
  • UC Browser for Android
Vadim Hulevich
  • 1,803
  • 8
  • 17