3

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?

Chankey Pathak
  • 21,187
  • 12
  • 85
  • 133
user3456607
  • 67
  • 1
  • 6

3 Answers3

0

This solved my problem:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
user3456607
  • 67
  • 1
  • 6
0
new OpenLayers.Layer.OSM()

does't work for me on IE11 as well.

I tried with https scheme since there was changes with redirecting from http to https for openstreetmap tiles:

new OpenLayers.Layer.OSM({
            name: "OpenStreetMap",
            url: ["https://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
                "https://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
                "https://c.tile.openstreetmap.org/${z}/${x}/${y}.png"],
            tileOptions: {crossOriginKeyword: null},
            crossOrigin: null
        });

Still not rendered from my local in IE11. Also provided metatag doesn't help...

Another one works fine (but I need X.tile.openstreetmap.org for rendering):

 new OpenLayers.Layer.OSM("OpenCycleMap",
                   ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
                    "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
            "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"]);
0

This worked for me:

new OpenLayers.Layer.OSM("OpenStreetMap", ["https://a.tile.openstreetmap.org/${z}/${x}/${y}.png", "https://b.tile.openstreetmap.org/${z}/${x}/${y}.png", "https://c.tile.openstreetmap.org/${z}/${x}/${y}.png"]);