Geo Location Script – Greet Your Visitors By Their City

Discussion in 'Other' started by imfcuk, Nov 2, 2009.

  1. imfcuk

    imfcuk Make Money Online Very Active Members

    Joined:
    Sep 15, 2009
    Messages:
    1,382
    Likes Received:
    10
    Trophy Points:
    0
    Code:
    You are here <script src="http://www.google.com/jsapi" type="text/javascript"></script><script type="text/javascript"><!--
    if (typeof(google.loader.ClientLocation.address.city) != null) {
      document.write(google.loader.ClientLocation.address.city
      +", "
      +google.loader.ClientLocation.address.region);
    } else {
      document.write("San Diego, CA")
    }
    // --></script>
    
    P.S. Visitors location will not appear if they're behind a proxy.
     
  2. sf

    sf Busy

    Joined:
    Dec 15, 2008
    Messages:
    789
    Likes Received:
    32
    Trophy Points:
    0
    HTML:
    <html>
    <head>
    <script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
    <script language="JavaScript">
    var city = geoip_city();
    var country = geoip_country_name();
    </script>
    </head>
    <body>
    You are from <script>document.write(city)</script>, <script>document.write(country)</script>.
    </body>
    </html>
    Here's a custom one that I decided make (only 1min of coding)...

    I decided that there should be a maxmind one here after fcuku used maxmind to show you how to redirect offers
     
  3. sf

    sf Busy

    Joined:
    Dec 15, 2008
    Messages:
    789
    Likes Received:
    32
    Trophy Points:
    0
    Well saying that I can't edit...

    Sorry about the code above. That one isn't really optimized. If you wish to use a more optimized version, then here you go.

    HTML:
    <html>
    <head>
    <script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
    </head>
    <body>
    You are from <script>document.write(geoip_city())</script>, <script>document.write(geoip_country_name())</script>.
    </body>
    </html>
    It might only be a few lines of code. But every bit helps ;)
     
  4. aj113

    aj113 Make Money Online Very Active Members

    Joined:
    Oct 13, 2009
    Messages:
    482
    Likes Received:
    12
    Trophy Points:
    18
    I spent a full day trying to find a decent geo location script that would work in most scenarios - including proxies. In the end the best thing that worked for me was to use a well-known site in an i-frame courtesy of cakeslice.
     
  5. gorico

    gorico Make Money Online

    Joined:
    Nov 12, 2010
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    0
    Even though I don't understand the code ,thank you for sharing.
     

Share This Page