Geolocation-API-Polyfill is a project mainly written in JavaScript, it's free.
This library provides a consistent Geolocation API for miscellaneous web browsers and also acts as polyfill. It only supports Javascript in a web browser and is not tested and will maybe not work for use in Titanium, PhoneGap, etc.