taudorf
taudorf

Reputation: 793

Google Maps API Key alert

I have a problem with my Google Maps API key. I get an alert saying "This web site needs a different Google Maps API key." When I prees OK to the alert the map are loading and working fine.

The same problem is already posted: Google Maps API key not working

I have tried to request the API key for both "http://www.domain.com" and "http://domain.com" but I still get the alert. When I follow the instructions from their FQA and use alert(window.location.host) I get www.domain.com but the api key generator will only accept the domain if the prefix is http://

Does anyone have a solution to this?

Upvotes: 7

Views: 5665

Answers (3)

John Reilly
John Reilly

Reputation: 11

I had the same problem. I remembered that Google calls my Appspot app by a different name found in the Versions area of the App Engine Dashboard. I changed the name of the URL to the long version and the key started to work... e.g. LIVE URI... http://5.latest.myappname.appspot.com.

You'd think they could resolve their keys to their own app hosting service urls.

Regards, John

Upvotes: 1

taudorf
taudorf

Reputation: 793

I found out that is was a generel encoding error in my google maps api script tag. I got the alert error when I had a script tag like this:

<script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=MyGoogleMapsApiKey" type="text/javascript"></script>

The problem here is the duplicated amp;wich was generated from a scriptmanager in asp.net. So the & was replaced with &amp;.

The script tag should look like this:

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=MyGoogleMapsApiKey" type="text/javascript"></script>

So if you are using a scriptmanager to add script tags or in any other way dynamically adding script tags to your pages, wach out for duplicated amp;.

Upvotes: 7

vuthaKH
vuthaKH

Reputation: 163

You have to sign up for the new google API key for your new domain, I used to get the same error message, because I use the old API with the new domain, please click the following link to register your new API key for the new domain.

http://code.google.com/apis/maps/signup.html

Hope this can help.

Vutha

Upvotes: 1

Related Questions