Google Map Example
Your current location is:
Source Code
<script type="text/javascript" src="http://loki.com/plugin/files/loki.js"></script>
<script type="text/javascript">
//<![CDATA[
var map;
function init() {
// Setup the GMap instance
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(42.36463232550283, -71.05836868286133), 13);
var marker = new GMarker(point);
map.addOverlay(marker);
// and kick off the Loki request
requestLocation();
}
function requestLocation() {
var loki = new LokiAPI();
loki.onSuccess = function(location) {
// Re-center the map and place a new marker based on the user's location
var point = new GLatLng(parseFloat(location.latitude), parseFloat(location.longitude));
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(location.latitude+', '+location.longitude+'');
};
loki.onFailure = function(error, msg){
alert('An error has been encountered ('+error+'). '+msg);
};
loki.setKey("loki.com");
loki.requestLocation(true,loki.NO_STREET_ADDRESS_LOOKUP);
}
window.onload = init;
//]]>
</script>