当您的网站通过HTTPS加载时,Google Maps Marker Clusterer Plus默认图标仍然通过纯HTTP加载
这会触发大多数浏览器的“混合内容”警告
答案 0 :(得分:1)
只需添加以下行:
MarkerClusterer.IMAGE_PATH = "https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/images/m";
在致电Google Maps Marker Clusterer Plus之前
:var markerCluster = new MarkerClusterer(map, allMarkersArray, mcOptions);
答案 1 :(得分:1)
您也可以通过在实例化MarkerClusterer时指定imagePath选项,以与Anthony's answer类似的方式解决此问题(如下所示):
var mc = new MarkerClusterer(map, markers, {
imagePath: 'https://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/images/m'
});
更新:一段时间前Google moved the MarkerClustererPlus source over to GitHub,Google代码版本现已停止使用,您应使用以下脚本网址之一使用新的GitHub托管版本(标准版)和打包版本):
https://cdn.rawgit.com/googlemaps/v3-utility-library/master/markerclustererplus/src/markerclusterer.js
https://cdn.rawgit.com/googlemaps/v3-utility-library/master/markerclustererplus/src/markerclusterer_packed.js
在实例化MarkerClusterer时,您还需要将imagePath选项定向到新的托管位置,如下所示:
var mc = new MarkerClusterer(map, markers, {
imagePath: 'https://cdn.rawgit.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m'
});
在制作中,应使用上面的网址(带有cdn前缀),因为它们有no traffic limits or throttling and the files are served via a super fast global CDN。但请注意,作为免费服务,它提供no uptime or support guarantees。
以下SO答案中详细介绍了访问Git托管的文件: