Google has disabled use of the Maps API for this application

用google地图时提示如下错误:

Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v2 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: http://code.google.com/apis/maps/documentation/javascript/v2/introduction.html#Obtaining_Key

目前google maps javascript api 最新版本是v3,v3 把 api 引用改为v3的就可以了,SET_TO_TRUE_OR_FALSE 值为true 或false 全小写

<!DOCTYPE html>
<html>
 
<head>
   
<metaname="viewport"content="initial-scale=1.0, user-scalable=no"/>
   
<styletype="text/css">
      html
{height:100%}
      body
{height:100%;margin:0;padding:0}
     
#map_canvas {height:100%}
   
</style>
   
<scripttype="text/javascript"
     
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE">
   
</script>
   
<scripttype="text/javascript">
     
function initialize(){
       
var mapOptions ={
          center
:new google.maps.LatLng(-34.397,150.644),
          zoom
:8,
          mapTypeId
: google.maps.MapTypeId.ROADMAP
       
};
       
var map =new google.maps.Map(document.getElementById("map_canvas"),
            mapOptions
);
     
}
   
</script>
 
</head>
 
<bodyonload="initialize()">
   
<divid="map_canvas"style="width:100%;height:100%"></div>
 
</body>
</html>

具体解决如下:https://developers.google.com/maps/documentation/javascript/tutorial

原文地址:https://www.cnblogs.com/liuyuhua/p/2811227.html