在Maps JavaScript API Hello World示例中包含mootools.min.js会导致街景功能无法渲染街景图像。我正在使用Joomla,在插入代码之前先加载mootools。
在使用documentation中提供的HelloWorld示例之前,我一直解决问题。我本地的mootools版本是1.4.5。我已经使用托管的1.45和最新的版本1.6.0对它进行了测试。
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.6.0/mootools.min.js"></script>
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE&callback=initMap"
async defer></script>
</body>
</html>
将街景用户放到街道网络后,我看到两个控制台错误:
获取有关:无效网络:: ERR_UNKNOWN_URL_SCHEME
街景界面似乎正常工作-导航箭头显示并可以单击,只是没有图像。