[JS] HTML5 Geolocation – 取得地理位置定位資訊 (GEO)

以下範例Code:

if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(res){
        console.log(res.coords);
    }, function(error){
        console.log(error);
    });
} else {
    console.log("Geolocation is not supported by this browser.");
}

Leave a Reply

Your email address will not be published. Required fields are marked *