There are countless examples where this one is different in that it's in it's own class.

Simple usage
Include jQuery and geolocation.js (included in the link below)

Code:
$(document).ready(function () {

    var positionOptions = {
        timeout: Infinity,
        maximumAge: 0,
        enableHighAccuracy: true
    };


    $geoLocation.Init(positionOptions);
    $geoLocation.Execute();

    ...

}();
There are stub functions to use for writing to a database or log file.

Full source on GitHub repo with link to Microsoft TechNet article which provides information on using geolocation and how to test on desktop and mobile devices.

Name:  F1.png
Views: 909
Size:  20.8 KB

Name:  F2.png
Views: 979
Size:  72.2 KB