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

2 comments:

  1. callezee said...:

    Thanks for the info,now only i booked a domain and its really helpful..

  1. Thanks for this suggestion.I follow your link when i faced a error to compile a programmed and also your description tricks is very very easily acceptable in a programmer.
    Follow this link:-
    http://www.ssdntech.com/dotnet-training.aspx

Post a Comment

Thanks for the Comments.

PayOffers.in