Google Map API显示错误" google未定义"在控制台上

时间:2017-04-06 06:40:02

标签: javascript google-maps

我正在使用谷歌地图api在我的网站上显示地图。有时它工作正常,但有时我在浏览器控制台中收到以下错误。我会非常感激的。任何人都可以帮我解决这个问题。

Uncaught ReferenceError: google is not defined
at render_map (_main.js:3)
at HTMLDivElement.<anonymous> (_main.js:10)
at Function.each (jquery.min.js:2)
at n.fn.init.each (jquery.min.js:2)
at HTMLDocument.<anonymous> (_main.js:10)
at j (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at Function.ready (jquery.min.js:2)
at HTMLDocument.K (jquery.min.js:2)

Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

1 个答案:

答案 0 :(得分:0)

根据您的错误:NoApiKeys警告

加载API的脚本元素没有API密钥。请确保包含有效的API密钥作为关键参数。您可以在Google API控制台上生成新的API密钥。

查看此链接以获取错误消息 https://developers.google.com/maps/documentation/javascript/error-messages