The following java script should work for you:
var key1 = 'googlemapkeyfordomain1';
var key2 = 'googlemapkeyfordomain2';
var myKey = key1;
if (window.location.host == 'www.domain1.com' ||
window.location.host== 'domain1.com') {
myKey = key1;
}
else if (window.location.host == 'www.domain2.com' ||
window.location.host== 'domain2.com') {
myKey = key2;
}
else {
myKey = key1;
}
var scriptTag = '<' + 'script src="http://maps.google.com/maps?
file=api&v=2&key=' + myKey + '">'+'<'+'/script>';
document.write(scriptTag);
Generate the key from http://code.google.com/apis/maps/signup.html and
put the key values in key1 and key2.
Good luck!
Lawrence
On Mar 2, 3:07 am, nathaniel david <[email protected]> wrote:
> Hi Lex
>
> " A single Maps API key is valid for a single "directory" or domain"
>
> Read and generate your key on the url given below.
> You can generate api key onhttp://code.google.com/apis/maps/signup.html
>
> Aniracz
>
> On Tue, Mar 2, 2010 at 4:55 PM, LexT <[email protected]> wrote:
> > Hi,
>
> > a client of mine has a website with two domain names. Her site is
> > accessible with both domain names.
>
> > The google map api only works for one domain, and if browsing on the
> > other domain, people get to see an error message:
>
> > "This web site needs a different Google Maps API key. A new key can be
> > generated athttp://code.google.com/apis/maps/."
>
> > I'm now looking if I can maybe forward people who click on the map
> > button to the one domain that it works on.
>
> > Site:
>
> >http://www.lailabungalows.com/index.php/en/map
> >http://www.laila-apartamentos.com/index.php/en/map
>
> > If it would be possible to somehow have it working on both domains,
> > that'd be great. Is that possible?
>
> > Thanks,
>
> > Lex
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Maps API" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-maps-api%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-maps-api?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.