2

Does anyone know how to automatically detect which country a user is in when browsing a website?

It is not so that the language changes, but the actual content changes and loads depending on which country the user is in - most specifically the contact details need to load differently from US to UK.

I have noticed that moo.com have somehow done it but have no clues.

Any help greatly appreciated.

DavePentland
  • 85
  • 1
  • 1
  • 8
  • 1
    Check out [this question](http://stackoverflow.com/questions/20185343/how-to-get-users-country-and-forward-to-url) – Anubian Noob May 26 '14 at 19:58
  • Here is for PHP one tip... you can combine it with Javascrit: http://www.php.net/manual/en/function.geoip-country-name-by-name.php – Pavel May 26 '14 at 20:53
  • Either one @AnubianNoob, just as long as it allows me to load different content depending on which country they are in. – DavePentland May 26 '14 at 21:19

1 Answers1

1

You can get the exact country but rarely you will get the city.

you need to call google service to fetch user location.

http://www.geoplugin.net/javascript.gp

or you can get the user location by using his latitude and longitude, by calling google service.

KhAn SaAb
  • 5,248
  • 5
  • 31
  • 52