|
Posted by Mark Goodge on 07/04/06 06:49
On Mon, 03 Jul 2006 22:22:08 -0400, Jerry Stuckle put finger to
keyboard and typed:
>Nospam wrote:
>> I have a few javascripts. I would like to show a certain script based on
>> the country ip of the viewer, how would I achieve this? is there html I
>> could use to run the javascript based on the country ip?
>>
>>
>
>You can't do it reliably. All you can do is take a guess at the country of the
>ip connecting to you, and that won't always be accurate. Plus they might be
>using a proxy anyplace in the world.
That's true, but it's not quite as bad as you make it sound. Freely
available Geo-IP databases will give over 95% accuracy, which is
usually enough for most purposes. Proxies aren't really a major issue,
as almost all well-configured proxies will pass the originating IP on
in the HTTP-FORWARDED-FOR header. Those that don't are generally those
which are deliberately designed to anonymise the origin, and that's
fairly rare.
The main problem is AOL, which will always appear as the US
irrespective of the user's actual location, as AOL configures all its
worldwide addresses from the same US-allocated pool. To get accurate
geo-location of AOL users, therefore, you need access to AOL's
internal database, and that isn't available for free. Some commercial
products include it (as well as other ISP cross-border databases), and
with that level of detail you can get over 99% accuracy - provided
you're prepared to pay for it.
To go back to the OP's question, Geo-IP detection is best done
server-side using a combination of scripting and a database, as you're
going to need to cross-check against a quite large amount of data.
It's pretty trivial with most server-side scripting/database
combinations, such as PHP/MySQL or ASP/MSSQL, but you do need a
certain familiarity with these in order to use them. If you don't want
to run your own database, I'd suggest using the freeware binary data
from MaxMind, together with one of their supplied APIs in the
scripting language of your choice:
http://www.maxmind.com/app/geoip_country
Mark
--
Visit: http://names.orangehedgehog.com - British surname distribution profiles
Listen: http://www.goodge.co.uk/files/dweeb.mp3 - you'll love it!
Navigation:
[Reply to this message]
|