Search the web for it. There are numerous examples available. On Feb 16, 2012 6:28 PM, "Tapan" <desaitap...@gmail.com> wrote:
> Hi Jeremy, > > Can you please give me some example or some more detail what you mean > by? > > Thanks, > Tapan > > > On Feb 16, 5:42 pm, Jeremy Geerdes <jrgeer...@gmail.com> wrote: > > Use the browser's geolocation api in js. > > On Feb 16, 2012 4:38 PM, "Tapan" <desaitap...@gmail.com> wrote: > > > > > > > > > Hi There, > > > > > I tried below code behind but it returns only server address (city/ > > > statE) where i am looking for client address, > > > > > Using client = New System.Net.WebClient() > > > Dim uri As New Uri("http://www.google.com/jsapi? > > > key=ABQIAAAADXAAAAlhkkFddu21dWEnADoyT5eRTf-CnUYIAMCE84kdF") > > > 'The first number is the status code, > > > 'the second is the accuracy, > > > 'the third is the latitude, > > > 'the fourth one is the longitude. > > > > > Dim geocodeInfo As String() = > client.DownloadString(uri).Split(",") > > > > > location = geocodeInfo(2) + ", " + geocodeInfo(3) > > > location = location.Replace("""", "") > > > location = location.Replace("address", "") > > > location = location.Replace(":", "") > > > location = location.Replace("{", "") > > > location = location.Replace("}", "") > > > location = location.Replace("city", "") > > > location = location.Replace("region", "") > > > 'Response.Write(location) > > > End Using > > > > > I am writting asp.net code to fetch user location, i tried using below > > > javascipt but its returning null, > > > > > <div id="yourinfo"></div> > > > <script type="text/javascript" src="http://www.google.com/jsapi? > > > key=ABQIAAAAlhkkFddu21dWEnADoyT5eRTf- > > > CnUYIAMCE84kdFgp23yBoSxxRRARHZ_qAFAjJHL5FfqIpQEpGzeiA"></script> > > > <script type="text/javascript"> > > > if (google.loader.ClientLocation) { > > > visitor_lat = google.loader.ClientLocation.latitude; > > > visitor_lon = google.loader.ClientLocation.longitude; > > > visitor_city = google.loader.ClientLocation.address.city; > > > visitor_region = google.loader.ClientLocation.address.region; > > > visitor_country = > > > google.loader.ClientLocation.address.country; > > > visitor_countrycode = > > > google.loader.ClientLocation.address.country_code; > > > document.getElementById('yourinfo').innerHTML = '<p>Lat/Lon: ' > > > + visitor_lat + ' / ' + visitor_lon + '</p><p>Location: ' + > > > visitor_city + ', ' + visitor_region + ', ' + visitor_country + ' (' + > > > visitor_countrycode + ')</p>'; > > > } > > > else { > > > document.getElementById('yourinfo').innerHTML = '<p>Whoops!</ > > > p>'; > > > } > > > </script> > > > > > I would really appriciate your help on this one. > > > > > Thanks, > > > Tapan > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Google AJAX APIs" group. > > > To post to this group, send email to > > > google-ajax-search-api@googlegroups.com > > > To unsubscribe from this group, send email to > > > google-ajax-search-api+unsubscr...@googlegroups.com > > > To view this message on the web, visit > > >http://groups.google.com/group/google-ajax-search-api?hl=en_US > > > For more options, visit this group at > > >http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en-Hide > > >quoted text - > > > > - Show quoted text - > > -- > You received this message because you are subscribed to the Google > Groups "Google AJAX APIs" group. > To post to this group, send email to > google-ajax-search-api@googlegroups.com > To unsubscribe from this group, send email to > google-ajax-search-api+unsubscr...@googlegroups.com > To view this message on the web, visit > http://groups.google.com/group/google-ajax-search-api?hl=en_US > For more options, visit this group at > http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en > -- You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to google-ajax-search-api@googlegroups.com To unsubscribe from this group, send email to google-ajax-search-api+unsubscr...@googlegroups.com To view this message on the web, visit http://groups.google.com/group/google-ajax-search-api?hl=en_US For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en