OpenLayers: Does not work in internet explorer

2019-08-07 01:43发布

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?

1条回答
来,给爷笑一个
2楼-- · 2019-08-07 02:15

This solved my problem:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
查看更多
登录 后发表回答