Google has disabled use of the Maps API for this application

本文介绍了解决Google Maps API使用中出现的错误方法,包括如何获取有效的API密钥及更新API版本到v3的具体步骤。

用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/archive/2012/12/10/2811227.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值