There are some free services out there that let you make country and IP-based geolocalization from the client-side.

wipmania is a free JSONP service can be used to determine visitor's country, it's really simple to use:

<script type="text/javascript">
// plain JavaScript example
function jsonpCallback(data) {
alert('Latitude: ' + data.latitude +
'\nLongitude: ' + data.longitude +
'\nCountry: ' +;
<script src=""

Or if you use a framework that supports JSONP, like jQuery you can:

// jQuery example
$.getJSON('', function (data) {
alert('Latitude: ' + data.latitude +
'\nLongitude: ' + data.longitude +
'\nCountry: ' +;

Check the above snippet running here.

Instead of an alert dialog (as in the above example), if you want to redirect an URL that takes a US visitor to a .COM address & allows a Canadian visitor passes through normally (for a .ca version of a website with a sister .com version site), simply use a "switch" statement in the "onload" event, check the "country" returned from the json function, then call Server.Transfer ( or similiar.

Other articles of this category:

I Recommend RamNode VPS Hosting

high performance ssd vps