How do you detect a website visitor's country (Specifically, US or not)?

Posted by BigDave on Stack Overflow See other posts from Stack Overflow or by BigDave
Published on 2010-01-28T16:49:04Z Indexed on 2010/04/14 6:53 UTC
Read the original article Hit count: 320

I need to show different links for US and non-US visitors to my site. This is for convenience only, so I am not looking for a super-high degree of accuracy, and security or spoofing are not a concern.

I know there are geotargeting services and lists, but this seems like overkill since I only need to determine (roughly) if the person is in the US or not.

I was thinking about using JavaScript to get the user's timezone, but this appears to only give the offset, so users in Canada, Mexico, and South America would have the same value as people in the US.

Are there any other bits of information available either in JavaScript, or PHP, short of grabbing the IP address and doing a lookup, to determine this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about php