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: ' + data.address.country);
}
</script>
<script src="http://api.wipmania.com/jsonp?callback=jsonpCallback"
type="text/javascript"></script>

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

// jQuery example
$.getJSON('http://api.wipmania.com/jsonp?callback=?', function (data) {
alert('Latitude: ' + data.latitude +
'\nLongitude: ' + data.longitude +
'\nCountry: ' + data.address.country);
});

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 (asp.net) or similiar.

Other articles of this category:

I Recommend RamNode VPS Hosting

high performance ssd vps