最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - using google maps api without a key - Stack Overflow

matteradmin8PV0评论

The instructions for v.3 of the Google Maps API say that I

should load the Maps API using an API key

Curiously it says I should..., rather than I must..... Anyhow, at the moment, I am not using an API key simply because (as far as I can remember) there was no mention of an API key when I was writing the code that calls this API.

Should I go back and add an API key to the URL that loads the API? It seems to work fine without the key, so I don't have any particular incentive to do this.

The instructions for v.3 of the Google Maps API say that I

should load the Maps API using an API key

Curiously it says I should..., rather than I must..... Anyhow, at the moment, I am not using an API key simply because (as far as I can remember) there was no mention of an API key when I was writing the code that calls this API.

Should I go back and add an API key to the URL that loads the API? It seems to work fine without the key, so I don't have any particular incentive to do this.

Share Improve this question asked Jul 9, 2012 at 14:56 DónalDónal 188k177 gold badges586 silver badges844 bronze badges 3
  • I thought it does only work without a key on localhost? – Luke Commented Jul 9, 2012 at 14:57
  • @Luke: That's how it was with the API V2. – Marcelo Commented Jul 9, 2012 at 15:34
  • Now you must use an API key but there is a workaround: stackoverflow./questions/38148097/… – baptx Commented Sep 11, 2016 at 19:33
Add a ment  | 

3 Answers 3

Reset to default 4

You're actually required to not have a key if you're a business user. Here's a quote from Google:

Google Maps API for Business developers must not include a key in their requests. Please refer to Loading the Google Maps JavaScript API for Business-specific instructions.

Normal users, however, will be fine with or without a key, although Google remends having a key so you can monitor the API usage. Here is a quote verifying this:

The Google Maps JavaScript API V3 does not require a key, but there are benefits to using one.

You only need a key if you want to use the API management console to restrict access, collect usage statistics, etc. So, a key is remended but not required. See Obtaining an API key

In Api version 2 a key is required to run gmap out of localhost in the API v3 a key is not required

Post a comment

comment list (0)

  1. No comments so far