我已閱讀關於此錯誤的所有教程。但我無法解決我的問題。我想用Google apis根據我的經度和緯度顯示地圖。 我加入地圖API使用谷歌地圖類似如下:您已在此頁面上多次包含Google Maps API錯誤雖然我並不包含
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
這個庫中添加_Layout.cshtml後,我得到了錯誤,如如下:
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
是這個錯誤發生,即使沒有在map.cshtml文件中添加有關Google地圖的任何代碼。所以我認爲這個錯誤與谷歌地圖代碼無關。在map.cshtml文件谷歌地圖代碼如下如下:
<script>
$(document).ready(function() {
InitializeMap();
});
function InitializeMap() {
var data = {
Latitude: '@Model.Latitude',
Longitude: '@Model.Longitude'
};
var latlong = new google.maps.LatLng(data.Latitude, data.Longitude);
var myOptions = {
zoom: 12,
center: latlong,
mapTypeControl: true,
scaleControl: true,
zoomControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_CENTER
},
fullscreenControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("Map"), myOptions);
}
</script>
div標籤,它會顯示谷歌地圖就像如下:
<div id="Map" style="width: 750px; height: 500px"></div>
我搜索「googleapis」一詞在目前所有的項目但我找不到另一個。錯誤如下:
檢查開發人員工具控制檯/網絡並在加載頁面時檢查標籤頁 - 您應該能夠看到發生的位置和方式 –