How to detect country / location of visitor? [duplicate] How to detect country / location of visitor? [duplicate] javascript javascript

How to detect country / location of visitor? [duplicate]


NetImpact provide a free API for geolocation lookup by IP, ProgrammableWeb also has a roundup of GeoIP lookup providers. This involves a small amount of latency while your application completes an API call (unless your application can use a non-blocking call) but is the least intrusive manner of detecting a visitor's country of origin.


The browser header just tells you what language the user wants to see. A Spanish-speaking person on a business trip to Japan probably wants to see websites in Spanish.

I think you can use reverse-IP services to make a guess, but if it's for commerce purposes I think you have to ask the user to tell you.

Similarly with geo-location: the physical position of the computer may or may not be relevant to the needs of the user browsing the site.