Google Maps API warning: NoApiKeys

前端 未结 4 1121
执笔经年
执笔经年 2020-12-12 16:03

I\'ve been using Google Maps API v3 for some time without an API key, and it worked well.
It still works, but I get a warning in the console:

Goog

相关标签:
4条回答
  • 2020-12-12 16:26

    I had the same problem and I found out that if you add the URL param ?v=3 you won't get the warning message anymore:

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3"></script>
    

    Reproduction online

    As pointed out in the comments by @Zia Ul Rehman Mughal

    Turns out specifying this means you are referring to old frozen version 3.0 not the latest version. Frozen old versions are not updated with bug fixes or anything. But this is good to mention though. https://developers.google.com/maps/documentation/javascript/versions#the-frozen-version

    Update 07-Jun-2016

    This solution doesn't work anymore.

    0 讨论(0)
  • 2020-12-12 16:31

    Google maps requires an API key for new projects since june 2016. For more information take a look at the Google Developers Blog. Also more information in german you'll find at this blog post from the clickstorm Blog.

    0 讨论(0)
  • 2020-12-12 16:35

    A key currently still is not required ("required" in the meaning "it will not work without"), but I think there is a good reason for the warning.

    But in the documentation you may read now : "All JavaScript API applications require authentication."

    I'm sure that it's planned for the future , that Javascript API Applications will not work without a key(as it has been in V2).

    You better use a key when you want to be sure that your application will still work in 1 or 2 years.

    0 讨论(0)
  • 2020-12-12 16:42

    Creating and using the key is the way to go. The usage is free until your application reaches 25.000 calls per day on 90 consecutive days.

    BTW.: In the google Developer documentation it says you shall add the api key as option {key:yourKey} when calling the API to create new instances. This however doesn't shush the console warning. You have to add the key as a parameter when including the api.

    <script src="https://maps.googleapis.com/maps/api/js?key=yourKEYhere"></script>
    

    Get the key here: GoogleApiKey Generation site

    0 讨论(0)
提交回复
热议问题