Configure the Google Map API key for Multiple domains

Posted by Venkat | Labels: ,

Recently I am looking in to the issue.. how to configure the google map API key for the Multiple Domains.

In my case i have two domains : Create a Google MAP API key for the Two Domains

Example:

'domain1.com' : 'api-key-for-domain1'
'domain2.com' : 'api-key-for-domain2'


So use this Javascript instead of your previous Javascript




<script type="text/javascript">
var strKey = "";

switch (window.location.host)
{
case 'domain1.com':
strKey = 'ABsdfQIAA34AArNH17caPfR3kIylWMznsdfh3xTfvmRwsdfsd6dRB3osdfVmrrtfPwNADfaZlxQgtqbBp4xswSjiA0KYuB2Y2ynaUQ';
break;
case 'domain2.au':
strKey = 'Agbs42BQIAdfsAAArNH17caPfdfdfR3kIylWMfsdznh3xRosdfqCxgZKzqbnVvUHRgAMBYHaL-QhSwZqznIVtPbMQt4wrboRbFET9LYQ';
break;

}

document.write('<'+'script src="http://maps.google.com/maps?file=api&v=2&key='
+ strKey + '" type="text/javascript">' + '<'+'/script>');
</script>




So try the above script - this will work for multiple domains.

Ref:


http://groups.google.com/group/google-maps-api/browse_thread/thread/3c300b5be6b5cad7/77037ee6035f2c84?lnk=gst&q=multiple+domains#77037ee6035f2c84

PayOffers.in