Geo Location Script – Greet Your Visitors By Their City

imfcuk

Make Money Online
Very Active Members
Joined
Sep 15, 2009
Messages
1,382
Reaction score
10
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.
 

sf

Busy
Joined
Dec 15, 2008
Messages
789
Reaction score
32
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
 

sf

Busy
Joined
Dec 15, 2008
Messages
789
Reaction score
32
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 ;)
 

aj113

Make Money Online
Very Active Members
Joined
Oct 13, 2009
Messages
482
Reaction score
12
Points
17
Age
40
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.
 

gorico

Make Money Online
Joined
Nov 12, 2010
Messages
41
Reaction score
0
Points
0
Even though I don't understand the code ,thank you for sharing.