Do you really need a plugin for something so simple?
if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(successFunction, errorFunction); }else{ errorFunction(); } function successFunction(position) { //uses HTML5 if available var lat = position.coords.latitude; var lng = position.coords.longitude; } function errorFunction(){ //uses IP if no HTML5 $.getJSON("http://freegeoip.net/json/", function(res){ var lat = res.latitude; var lng = res.longitude; }); }
Fiddle
This checks if the HTML5 geolocation API is supported, if any, it gets the coordinates, if it isn't, or if the HTML5 API fails for some reason, it uses the free geoIP service to get the coordinates.
adeneo
source share