【发布时间】:2019-04-07 11:57:30
【问题描述】:
仍然收到“抱歉!出了点问题。 此页面未正确加载 Google 地图。有关技术详情,请参阅 JavaScript 控制台。”在我输入 API 密钥后
!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDli7-1WRjUXMACkIg7H9ZFNakF1wiOORo&callback=initMap"
async defer></script>
</body>
</html>
【问题讨论】:
-
您刚刚在此处发布了您的 API 密钥吗?您的帐户会被锁定吗?
-
不,我之前没有在这里发布 API 密钥,我现在才发布它,因为我不知道为什么我仍然收到 opps 错误...在我插入了API 密钥。有什么建议我错过了什么吗?
-
我刚刚用我的 API 密钥检查了你的代码,它工作正常。检查您的 api 密钥或从您的帐户重新生成您的 api 密钥。希望对您有所帮助...
-
我仍然遇到同样的错误,我重新生成了一个新密钥并尝试了多个 web 浏览器
标签: javascript html