突然间,我遇到了这个奇怪的错误,我的 Google map 集成在 Firefox 上不再工作,而在 Chrome 上却工作得很好。
这是我的 map 的代码:
var map;
var myCenter = new google.maps.LatLng(42.439071, 19.266683);
var marker = new google.maps.Marker({
position: myCenter
});
function initialize() {
var mapProp = {
center: myCenter,
zoom: 14,
draggable: true,
scrollwheel: false,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map-canvas"), mapProp);
marker.setMap(map);
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map, marker);
});
};
google.maps.event.addDomListener(window, 'load', initialize);
google.maps.event.addDomListener(window, "resize", resizeMap());
$('#myMapModal').on('shown.bs.modal', function() {
resizeMap();
});
function resizeMap() {
if (typeof map =="undefined")
return;
var center = map.getCenter();
google.maps.event.trigger(map, "resize");
map.setCenter(center);
};
我这样包含它:
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
我收到以下错误
rd is not defined https://maps.gstatic.com/cat_js/intl/en_us/mapfiles/api-3/17/2/main.js (line 53)
有人知道如何修复这个错误吗?
这里有一个 JSFiddle 来测试它: http://jsfiddle.net/sTLY8/7/
最佳答案
将我的 Firefox 更新到版本 30 后,我的 Google map 应用程序遇到了同样的问题:
ReferenceError: xd is not defined https://maps.gstatic.com/intl/de_ALL/mapfiles/api-3/16/13/main.js line 54 > eval`
Firebug 似乎导致了这些错误,并且已经有一个 issue filed for this 。我在 Firebug 中禁用了脚本面板,现在它在 Firefox 中又可以正常工作了。
关于html - Google map 集成中出现“rd 未定义”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24208606/