{TametheBots}

Geolocation Api

The Result:

Geolocation API? No

Get Current Location?: It fails

Testing how geolocation API is handled.

            <script>
                if (navigator.geolocation) {
                    document.getElementById("supported").innerText = 'Yes';
        
        
                    const options = {
                        enableHighAccuracy: true,
                        timeout: 5000,
                        maximumAge: 0
                    };
        
                    function success(pos) {
                        const crd = pos.coords;
                        const output = `Your current position is:<br />
                        Latitude : ${crd.latitude}<br />
                        Longitude: ${crd.longitude}<br />
                        More or less ${crd.accuracy} meters.`;
                        document.getElementById("result").innerHTML = output;
                    }
        
                    function error(err) {
                        const output = `ERROR(${err.code}): ${err.message}`;
                        document.getElementById("result").innerHTML = output;
                    }
        
                    navigator.geolocation.getCurrentPosition(success, error, options);
                } 
            </script>

< Back