您的位置:首页 > 移动开发

Google has disabled use of the Maps API for this application

2012-12-10 13:31 525 查看
用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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐