Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am serving the following files from a the same directory on localhost:


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:

<script src="OpenLayers.js"></script>
<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",
        "", {layers: 'basic'} );

    <!-- 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

    <!-- Zoom -->"loadend", kml, function (e) {


Any ideas?

share|improve this question

I think you might have an error in the javascript code which is only triggered by IE. To better understand what's going on in IE I recommend you install the Developer Toolbar, available as a free add-on from Microsoft:

IE9 should already have it installed by default.

After installing the IE Developer Toolbar open it by pressing F12 and then look for errors in the javascript console.

Alternatively you can comment out portions of code starting from and see if that fixes it.

Updated after comment

IE chokes because the web server does not return application/xml as the content type. Use the dev toolbar to confirm (inspect network traffic).

To fix configure files with .kml extension as application/xml into your web server configuraion.

share|improve this answer
It is the KML Vector layer that breaks IE. It's an unknown Javascript error and from what I have read may be related to IE's same origin policy, even though the KML, HTML and javascript are hosted on the same server. – user8204 Jun 14 '12 at 14:54
I have updated the answer as per your comment – unicoletti Jun 14 '12 at 18:10
I added the mime mapping to jetty but still got the same issue: SCRIPT16389: Unspecified error. OpenLayers.js, line 2589 character 96. – user8204 Jun 18 '12 at 8:13
Could you make the map publicly available so that we can look at at it? – unicoletti Jun 18 '12 at 10:52

Could this be because of the 'loadend' event? I think it does have issues with IE

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.