-2
Google Maps API錯誤:MissingKeyMapError, 但我有一個API密鑰,並將它傳遞給js。爲什麼它不起作用?Google Maps API錯誤:MissingKeyMapError,但我有一個密鑰
<script src="https://maps.googleapis.com/maps/api/js?Key=MY_API_KEY&callback=myMap"></script>
和
<div id="googleMap" style="width:100%;height:380px;"></div>
<script>
function myMap() {
var mapProp = {
center: new google.maps.LatLng(30.331917,57.017670),
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
}
</script>
我的測試頁:http://shahrkharid.org/GoogleMap.html