mardi 25 septembre 2018

how to keep asking user to allow location in browser [duplicate]

This question already has an answer here:

is there any solution to keep ask user allow location in browser if is say no my code needs to access location of user to work

    <script>

$(document).ready(function(){
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showLocation);
    } else { 
        $('#location').html('Geolocation is not supported by this browser.');
    }
});

function showLocation(position) {

    var latitude = position.coords.latitude;
    var longitude = position.coords.longitude;


    $.ajax({
        type:'POST',
        url:'/location',
        data:'latitude='+latitude+'&longitude='+longitude,
        success:function(msg){
            if(msg){
            }else{
            }
        }
    });

}
</script>



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2xSRmKv
via IFTTT

Aucun commentaire:

Enregistrer un commentaire