Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Learn More

'change' event for geolocator permission not triggered on change through permissions dialog

  • Нет ответов
  • 1 имеет эту проблему
  • 2 просмотра
more options

navigator.permissions.query({

      name: 'geolocation'

}).then(function(result) {

      result.onchange = function() {
         console.log('changed');
      };

})

Using the above code, when the location permission dialog shows up in the browser and the value is changed from 'Block'/'Ask by default' to 'Allow', the 'onchange' function or the 'change' event aren't triggered. Essentially when this permission is set by the user using this dialog, I would like to show a message to the user asking them to enable their location to proceed, if blocked.

navigator.permissions.query({ name: 'geolocation' }).then(function(result) { result.onchange = function() { console.log('changed'); }; }) Using the above code, when the location permission dialog shows up in the browser and the value is changed from 'Block'/'Ask by default' to 'Allow', the 'onchange' function or the 'change' event aren't triggered. Essentially when this permission is set by the user using this dialog, I would like to show a message to the user asking them to enable their location to proceed, if blocked.
Приложенные скриншоты