Jump to content
uniGUI Discussion Forums

GetLocation Example

Recommended Posts

Hi to you all,

Anyone has an example on how to get the current location of the connected client?

I found the following script in "Stack overflow", but don't know how to return back the 'loc.lat' and 'loc.lng' to my code 



<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
function initialize() {
var loc = {};
var geocoder = new google.maps.Geocoder();
if(google.loader.ClientLocation) {
loc.lat = google.loader.ClientLocation.latitude;
loc.lng = google.loader.ClientLocation.longitude;
var latlng = new google.maps.LatLng(loc.lat, loc.lng);
geocoder.geocode({'latLng': latlng}, function(results, status) {
if(status == google.maps.GeocoderStatus.OK) {
google.load("maps", "3.x", {other_params: "sensor=false", callback:initialize});






Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now