Google Maps API Key Alert

I have a problem with my Google Maps API key. I get a warning: β€œ This web site needs a different Google Maps API key. ” When I warn about this, the map loads and works fine.

Same problems already sent: Google API API not working

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

Does anyone have a solution?

+7
google-maps
source share
3 answers

I found out that this was a common coding error in my google maps api script tag. I got a warning 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 duplication of amp; that was generated from a script writer in asp.net. Thus, & was replaced by &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 use the scriptmanager to add script tags, or in any other way, by dynamically adding script tags to your pages, skip to duplicate amp; .

+7
source share

You need to register for the new Google API key for your new domain, I used to get the same error message because I am using the old API with the new domain, please click the following link to register the new API key for the new domain.

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

Hope this helps.

Vutha

+1
source share

I had the same problem. I recalled that Google calls my Appspot application a different name, which is located in the Version area of ​​the App Engine toolbar. I changed the name of the url to a long version and the key started to work ... for example. LIVE URI ... http://5.latest.myappname.appspot.com .

You might think that they can resolve their keys to their own application hosting URLs.

Regards, John

+1
source share

All Articles