I want to identify a user's country by using JavaScript. I want there are ways to do that using the IP address or geolocation. Is there any other way to accomplish this task? (let's say read it from user's computer) I want to avoid relying for example on an external service like this http://smart-ip.net/ because very often it takes quite a lot to respond. Any suggestion please?
Asked
Active
Viewed 1,279 times
1
-
You have to do this on the server. – elclanrs Aug 20 '13 at 22:19
-
3[How to get visitor's location (i.e. country) using javascript geolocation](http://stackoverflow.com/questions/3489460/how-to-get-visitors-location-i-e-country-using-javascript-geolocation) – Itay Aug 20 '13 at 22:20
-
You can try checking this out: http://dev.maxmind.com/geoip/legacy/javascript/ – David Starkey Aug 20 '13 at 22:20
-
Why are you trying to get the user's location? Is it to direct them to the closest store? To select the default language? To ban users in certain countries? IP to GeoLocation is mildly inaccurate at best, WILDLY inaccurate a lot of the time. – Jeremy J Starcher Aug 21 '13 at 03:18
1 Answers
0
Intl.DateTimeFormat().resolvedOptions().timeZone
or for more info
Intl.DateTimeFormat().resolvedOptions()
at this point maybe you are wondering how to get all the possible timezones
Intl.supportedValuesOf('timeZone')

Andrea Ciccotta
- 598
- 6
- 16