此页面未正确加载Google Maps [英] This page didn't load Google Maps correctly

查看:186
本文介绍了此页面未正确加载Google Maps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从后端网页上的Taxi App跟踪驱动程序以跟踪驱动程序映射,它给出了此错误

I want to track drivers from Taxi App on the back end web page to tracking drivers map it's give this error

此页面未正确加载Google Maps.有关技术详细信息,请参见JavaScript控制台.

This page didn't load Google Maps correctly. See the JavaScript console for technical details.

页面代码是:

    <?php 
require_once('../includes/config.php');
require_once('../includes/database.class.php');
$db= new database($pdo);
?>
<!DOCTYPE html> 
<html lang="en"> 
<head> 
<link href='http://fonts.googleapis.com/css?family=Dosis:400,700' rel='stylesheet' type='text/css'>

<title>map</title> 
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script type="text/javascript">
var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png",
new google.maps.Size(32, 32), new google.maps.Point(0, 0),
new google.maps.Point(16, 16));
var center = null;
var map = null;
var currentPopup;
var bounds = new google.maps.LatLngBounds();
 function addMarker(lat, lng, info ) {
 var pt = new google.maps.LatLng(lat, lng);
bounds.extend(pt);
var marker = new google.maps.Marker({
position: pt,
 icon: icon, 
map: map,
 });
var popup = new google.maps.InfoWindow({
});
 popup.setContent(info);
 popup.open(map, marker);
 google.maps.event.addListener(marker, "click", function() {
 if (currentPopup != null) {
currentPopup.close();
currentPopup = null;
}
popup.open(map, marker);
currentPopup = popup;
});
google.maps.event.addListener(popup, "closeclick", function() {
map.panTo(center);
currentPopup = null;
 });
}
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(0, 0),
 zoom: 1,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
},
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
}
});
<?php  
$db->mapOffers();
?>
center = bounds.getCenter();
 map.fitBounds(bounds);
}
</script>
<style>
 #map{
    border:#CCC thin solid;
    height: 480px;
    margin: 0 0 10px 0;
    padding: 0px
  }
</style>
</head> 
<body onload="initMap()" style="font-family: 'Roboto', sans-serif;" class="home"> 
<?php 
//  $db->mapOffers();
?>
<div id="map"></div>
</body> 
</html>

你能帮我吗

推荐答案

您需要在Google Map api脚本中包含一个键

You need to include a key in the google map api script

<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" type="text/javascript"></script>

您可以注册密钥: https://developers.google .com/maps/documentation/javascript/get-api-key

自2016年6月22日起,Google Maps V3不再支持无密钥访问(任何不包含API密钥的请求).

As of June 22, 2016 Google Maps V3 no longer support keyless access (any request that doesn't include an API key).

这篇关于此页面未正确加载Google Maps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆