getting user country
Posted on 2002-04-09
hello i want to find out if someone that is surfing is from the UK. i want to know this, because then i decide to show a user a UK targeted banner.
i now use this:
if (navigator.browserLanguage.substr(3,2) == "gb") || (navigator.browserLanguage.substr(3,2) == "ie"))
but, i discovered that most users use a united states browser and therefore their value of the substr(3,2) evaluates to "us". i can't display it to "us" users only, because this is way too much.