I have a google map that loads markers from a GeoJSON file that runs on localhost in Visual Studio 2013. It also runs in chrome (from an IIS server) but will not run in IE version 11. The map shows up, but the markers from the JSON file do not. Why would this work in Chrome on IIS 8, and IE 11 through VS, but not IE 11 on IIS 8?
var map;
var infowindow = new google.maps.InfoWindow({ });
function initialize() {
map = new google.maps.Map(document.getElementById('googleMap'), {
center: new google.maps.LatLng(15.508742, -0.120850),
zoom: 2,
mapTypeId: google.maps.MapTypeId.HYBRID,
scrollwheel: false
});
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
// Load a GeoJSON from the same server as our demo.
map.data.loadGeoJson('locations.json');
// Set event listener for each feature.
map.data.addListener('click', function (event) {
infowindow.setContent("<div> " + event.feature.getProperty('city') + " " + event.feature.getProperty('date') + "<br>" + event.feature.getProperty('course') + "<br>Sponsored by: " + event.feature.getProperty('sponsor') + "<br>" + "<a href=" + "/Training.aspx" + ">Click here to Register</a>" + "</div>");
infowindow.setPosition(event.latLng);
infowindow.setOptions({ pixelOffset: new google.maps.Size(0, -34) });
infowindow.open(map);
});
map.data.addListener('mouseover', function (event) {
//infowindow.setContent("<div class="map_info_box" > " + event.feature.getProperty('city') + " " + event.feature.getProperty('date') + "<br>" + event.feature.getProperty('course') + "<br>Sponsored by: " + event.feature.getProperty('sponsor') + "<br>" + "<a href=" + "/Training.aspx" + ">Click here to Register</a>" + "</div>");
infowindow.setContent("<div> " + event.feature.getProperty('city') + " " + event.feature.getProperty('date') + "<br>" + event.feature.getProperty('course') + "<br>Sponsored by: " + event.feature.getProperty('sponsor') + "<br>" + "<a href=" + "/Training.aspx" + ">Click here to Register</a>" + "</div>");
infowindow.setPosition(event.latLng);
infowindow.setOptions({ pixelOffset: new google.maps.Size(0, -34) });
infowindow.open(map);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…