Html5 геолокации возвращает ошибку недоступной позиции при входе в приложение rails с помощью devise omniauth - PullRequest
0 голосов
/ 27 ноября 2018

У меня есть приложение rails, в котором я реализовал устройство omniauth для Facebook, Twitter и Google.Также я предоставляю пользователю возможность подписаться / войти в систему со своей электронной почтой.

Я реализовал следующее html5 geolocation для поиска по текущему местоположению пользователя.

Когда я регистрируюсь / регистрируюсь по электронной почте, а не через учетную запись социальной сети, все работает просто отлично.Но если я войду с учетной записью в социальной сети, html5 geolocation выбрасывает Location information is unavailable из следующих showError function

function getLocationOther() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(setLocCookie,showError);
    } else {
        alert("Geolocation is not supported by this browser.");
    }
}


function showError(error) {
switch(error.code) {
    case error.PERMISSION_DENIED:
        window.location = window.location;
        window.alert("Please click on allow, pinsle can’t search and find results without your current location. If this message still appears even after you click on allow, then you need to enable the location services on your device. For more information on how to enable the location services,please go to the menu icon on the top right hand corner and then click on Get help and finally select How to enable the location services.");
        break;
    case error.POSITION_UNAVAILABLE:
        window.location = window.location;
        window.alert("Location information is unavailable.");
        break;
    case error.TIMEOUT:
        window.location = window.location;
        window.alert("The request to get user location timed out.");

        break;
    case error.UNKNOWN_ERROR:
        window.location = window.location;
        window.alert("An unknown error occurred.");
        break;
}
location.reload();
}

Любые идеи о том, как я могу обойти и запретить социальным сетям блокировать html5 geolocation * * 1013

...