Google Maps:未捕获的TypeError:类型错误 [英] Google maps: Uncaught TypeError: Type error
本文介绍了Google Maps:未捕获的TypeError:类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一些页面上,我已经开始出现上述错误,但是仅在Chrome中...
On a few pages, I've started getting the above error, but only in Chrome ...
以下是一些简单的代码来演示该错误:
Here is some simple code to demonstrate the error:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?key=AIzaSyD4uPYa8gidHCvCzXxEAalEzkEh94MhZYg&sensor=false"></script>
<script>function initializeMap() {
myLatlng = new google.maps.LatLng(42.791968,3.035231);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Tonys Place - Luxury apartment near the beach'
});
}
google.maps.event.addDomListener(window, 'load', initializeMap);
</script>
</head>
<body>
<div id="map_canvas" style="width: 400px; height: 400px">
</div>
</body>
</html>
我很困惑-任何想法都很感激!!!
I'm stumped - any ideas appreciated !!!
谢谢
推荐答案
我认为这与我最近遇到的问题相同.我通过在标记上添加"optimized:false"作为解决方法.
I think this is the same problem I recently had. I solved it by adding 'optimized: false' as an option on my markers.
marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Tonys Place - Luxury apartment near the beach',
optimized: false
});
这篇关于Google Maps:未捕获的TypeError:类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文