I am serving the following files from a the same directory on localhost:
map.html
OpenLayers.js
output.kml
map.html simply creates an OpenLayers map and displays the KML file as per the OpenLayers example. I access it via http://localhost:8080/map.html and it all works fine in Firefox and Chrome but not in IE. In IE I get the navigation buttons but no map. The OpenLayers example does work in IE...
The contents of map.html are shown below:
<html>
<head>
<title>Map</title>
<script src="OpenLayers.js"></script>
</head>
<body>
<div style="width: 100%; height: 100%" id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
<!-- Add background map -->
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
map.addLayer(wms);
<!-- Add kml layer -->
var kml = new OpenLayers.Layer.Vector("KML", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "output.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true,
maxDepth: 2
})
})
});
map.addLayer(kml);
<!-- Zoom -->
kml.events.register("loadend", kml, function (e) {
map.zoomToExtent(kml.getDataExtent());
});
</script>
</body>
</html>
Any ideas?
