bartosz.gorski
bartosz.gorski

Reputation: 11

Internet Explorer not working with here maps api version 3.1

I am trying make Here Maps working on internet explorer 11. I have added the legacy modules mentioned here: https://developer.here.com/documentation/maps/dev_guide/topics/migration.html and also I have changed the engine type to P2D. On chrome, firefox and Edge browsers everything is working just fine, but on IE11 nothing shows and I am getting an error in console: "Unable to get property 'util' of undefined or null reference mapsjs-service-legacy.js (7,1)".

Mentioned line looks like this H.service.util.eval(<Some other code>); and it seems like despite the fact the H object is imported it does not have a field named service.

My imports looks like this:

<link rel="stylesheet" type="text/css" href="https://js.api.here.com/v3/3.1/mapsjs-ui.css" />
<script src="https://js.api.here.com/v3/3.1/mapsjs-core.js" type="text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.1/mapsjs-core-legacy.js" type="text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.1/mapsjs-service.js" type=" text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.1/mapsjs-service-legacy.js" type="text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.1/mapsjs-ui.js"></script>
<script src="https://js.api.here.com/v3/3.1/mapsjs-mapevents.js"></script>

And JS code for map initialization:

var platform = new H.service.Platform({
    apikey: api_key
});
var defaultLayers = platform.createDefaultLayers();

var map = new H.Map(mapDiv,
    defaultLayers.raster.normal.map,{
        zoom: 4,
        center: {lat: 50, lng:5},
        engineType: H.map.render.RenderEngine.EngineType.P2D,
        pixelRatio: window.devicePixelRatio || 1

});

Anyone knows where the problem is and what should I change?

Upvotes: 0

Views: 343

Answers (1)

bartosz.gorski
bartosz.gorski

Reputation: 11

I have found what was wrong. It was additional space in type=" text/javascript inside mapsjs-service.js import:

<script src="https://js.api.here.com/v3/3.1/mapsjs-service.js" type=" text/javascript" charset="utf-8"></script>

Removing that space solved all my issues.

Upvotes: 1

Related Questions