Search code examples
internet-explorer-11openlayersopenstreetmapx-ua-compatible

OpenLayers: Does not work in internet explorer


I have this simple code:

<HTML>
<head>
<title>Vector Icon Example</title>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="../apidoc/styles/bootstrap.min.css">
<script src="../apidoc/scripts/bootstrap.min.js"></script>
    <link rel="stylesheet" href="../css/ol.css" type="text/css">
<script src="../build/ol.js"></script>


</head>
<BODY>
<div id="map" style="width: 100%, height: 400px">ggg</div>
<script>
  new ol.Map({
    layers: [
      new ol.layer.Tile({source: new ol.source.OSM()})
    ],
    view: new ol.View({
      center: [0, 0],
      zoom: 2
    }),
    target: 'map'
  });
</script>
</BODY>
</HTML>

It works correctly in chrome, but in IE 11 does not appear anything. where is the problem?


Solution

  • This solved my problem:

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">