Skip to content Skip to sidebar Skip to footer

HTML5 Geolocation - Not Working All The Time On IOS

Working currently with the HTML5 Geolocation and I've tested it on all web browsers and it seems to be working. However when I test the Geolocation on the iPad, it works for the iP

Solution 1:

I thought you should get location's permission first.

Add NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in App-Info.plist and give it a string.

Try with above, and see if that helps.

simple for no timer

<!DOCTYPE html>
<html>
<head>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>  
</head>
<body>
    <BR><BR><BR><BR>
    <button onclick="getLocation()">get Location</button>
    <script>
        function getLocation() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(alertPosition);
            } else {
                alert("Geolocation is not supported.");
            }
        }

    function alertPosition(position) {
        alert("Latitude: " + position.coords.latitude +
              "<br>Longitude: " + position.coords.longitude);
    }
    </script>
</body>
</html>

Post a Comment for "HTML5 Geolocation - Not Working All The Time On IOS"