SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Scripts to detect country and redirect user...

    Hello,

    Im wondering if a script exists that can detect the country of orgin and redirect the user to another page of my site...

    I.E.

    All non United States users go to page A
    All United States users go to page B


    Thanks!

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,812
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    That can be worked out using the IP address. Since Javascript doesn't have access to the IP address without using server side processing to pass it the process is best done completely with server side processing.

    IP addresses move at irregular intervals but there are sites available that can provide a file that matches IP addresses to country or even to city (although they will charge for the more detailed version at least since it will need updating every week).

    Note that the IP address identifies the location of the ISP being used and not that of the actual visitor although most people use a local ISP unless they are using an anonymous proxy instead which can put their location half way around the world from where they really are.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So what do you recommend I do? I only need to redirect US visitors to a differant page. Everyone else views the normal page...


    What options did I have - just server side?

    Thanks,
    calven

  4. #4
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes use server side scripting.


Bookmarks

Posting Permissions

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