bahry Posted July 9, 2018 Share Posted July 9, 2018 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) {alert(results[0]['formatted_address']);};});}}google.load("maps", "3.x", {other_params: "sensor=false", callback:initialize});</script> ++++++++++++++++++++++++++++++ Regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.