Visitors from either of 3 countries - New Zealand, Fiji or India - need a different content page respectively. The site is written in PHP, the content is in HTML files ready to be included.... I'm a newb; please be patient!!
A:
- Get the visitor's
IP
- Map the
IP
to itslocation
- Do a conditional
include
based on the location
codaddict
2010-04-22 02:09:39
if in neither of these countries the default content will apply but its not so likely anyone else will find the site really, its a indian church with office in those 3 countries
rowan
2010-04-22 02:54:38
thanks, im a newb can you help me with this?
rowan
2010-04-22 02:57:38
+1
A:
It's pretty easy to use Google's AJAX API loader to get a rough estimate of the user's location. Roughly:
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
// Note that you should have some sanity checks here, and maybe use an onLoad
// event of some kind
alert(google.loader.ClientLocation.address.country);
</script>
You could have the user start at a page that would then use JavaScript to redirect them to the appropriate location. If you're using any popular JavaScript libraries, you may already be using this loader (and if not, you should consider loading your libraries through it).
http://code.google.com/apis/ajax/documentation/#ClientLocation
awgy
2010-04-22 02:17:10
Test the country value and use that to redirect the browser to the appropriate location. Like Frank Farmer said, though, you should consider giving the user some way to override the automatic choice.
awgy
2010-04-22 13:01:58