Results 1 to 4 of 4

Thread: OnLoad detect country and redirect script

  1. #1
    Join Date
    Mar 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default OnLoad detect country and redirect script

    Hi guys,

    i hope you can help. I am looking for a script that will detect whether or not the user is based in the UK or Internationally and then change the page according to which geographical location the user is in.

    Can you help at all please? Thanks

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    2,025
    Thanks
    16
    Thanked 315 Times in 313 Posts
    Blog Entries
    13

    Default

    Google is your friend: http://www.google.com/m?q=country%20detection%20script

    However, you might want to avoid doing this as its not necessarily 100% reliable. I would say the better option would be to provide an easily visible country selection menu so the user can choose their own country - or use a combination of the 2 - - what if a visitor was travelling abroad and wanted to view content for their own region? Without the option to change they'd be pretty stuck.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  3. #3
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    597
    Thanks
    43
    Thanked 28 Times in 28 Posts

    Default

    Last edited by ajfmrf; 01-12-2013 at 12:23 AM. Reason: add more to post
    Thanks,

    Bud

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I've used GeoIP and I like it. For countries it should be reliable (90%+) and there are a few competing services out there that may also work.

    It will be a little work to set up, but it may help your website.

    However, I agree with Beverley that you need to be careful:
    1) It may make mistakes sometimes. Even if that's just 1% of users (and that would be lucky!) then you don't want them to have problems.
    2) Your physical location is not always useful information. People go on vacation, and they may want to buy something for when they return.
    3) If this has anything to do with languages, the languages people can read don't always correlate with location-- maybe they're recent immigrants, or maybe you don't have their native language available so they need to pick the next best option-- for example Hungarians might pick German, and you'd have very little chance knowing that.

    So... I suggest using the IP information as a first guess. I'm not sure I'd recommend using a redirect with it, but if you can actually integrate conditional content, that would be best. Or a redirect is fine as long as it isn't limiting or substantially different-- one page for people in the UK, and one page for others; but they have the same content overall.

    Then I think you MUST allow them an easy way to switch between the websites. If there are reasons that it might be a problem, inform the user. You shouldn't/can't rely on this information such as for tax purposes, etc., or anything important.


    And just for convenience-- for me while traveling I absolutely hate how Google doesn't let me choose my location for searches and attempts to "guess" what I want based on where I happen to be. It's hard to work around this (but there are options; I have an add-on for firefox now, for example), and there's really no reason it should be a problem. I like that it guesses my location and may be helpful if I want something local, but I hate that sometimes it limits what I can do. So again, make a first guess, and let the user do the rest.



    In fact, if this is important, you might consider having a one-time first page that asks them their location. You can use a locating script to guess for them and say "Are you in the UK?" or "Are you outside the UK?" based on what you know-- but then they can confirm this and you'll know the answer is right (and accurate for the individual, not their current physical location).

    That may sound excessive, but it is used fairly often for business websites. One that comes to mind is the FedEx website: http://www.fedex.com/
    Daniel - Freelance Web Design | <?php?> | <html>| espaņol | Deutsch | italiano | portuguęs | catalā | un peu de franįais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. How to detect iframe src after serverside redirect?
    By Birmingham in forum JavaScript
    Replies: 2
    Last Post: 07-17-2008, 10:39 AM
  2. Using body onload to redirect using images
    By remf in forum JavaScript
    Replies: 2
    Last Post: 07-30-2006, 05:11 PM
  3. current browser detect redirect script help
    By brent13a in forum JavaScript
    Replies: 3
    Last Post: 05-01-2005, 08:26 PM
  4. Detect Speed and Redirect
    By hldr in forum JavaScript
    Replies: 10
    Last Post: 04-23-2005, 09:00 PM

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
  •