I have a site that uses 2 domains to forward to the IP no. (a .org.uk and .co.uk). The site uses the Google Map API for a map on the site, however the API key is locked to the individual domain (I do have two keys for both the domains). I found the following Javascript which is supposed to switch the key depending on the domain that is accessing the page.
Code:
 if (window.location.host == 'www.domain1.com') { 
     document.write('<'+'script 
src="http://maps.google.com/maps?file=api&v=1&key=key/for/domain1" 
type="text/javascript">' + 
     '<'+'/script>'); 
   } else if (window.location.host == 'www.domain2.com') { 
     document.write('<'+'script 
src="http://maps.google.com/maps?file=api&v=1&key=key/for/domain2" 
type="text/javascript">' + 
     '<'+'/script>'); 
   } else { 
alert("host ="+window.location.host); 
}
but I can't get it to work, the page doesn't display any map (not even an alert) if I use this instead of the normal API key script.