Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    capturing country of visitors to website

    Hi,

    I want to gather the country of origin of visitors to my web site. If they are from what appears to be a global ISP, how can I get the country they live in? and if they are away from their home country - using a Internet cafe PC - How can I most easily, get their home country without asking them to enter it on a form?

    I thought of using env vars but after a few biffs, that seems not so good.

    bazz

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,460
    Thanks
    0
    Thanked 632 Times in 622 Posts
    You could look up the IP address they are using. That will give you the country where the ISP or proxy server they are using is located. In most cases they will probably be in that country. To handle the small percentage where that doesn't give the right country the only solution would be to ask them.

    See http://ip-to-country.webhosting.info/
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Thanks felgall, I'll take a look at that.

    bazz


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •