mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.2k stars 2.22k forks source link

Directions Example Not Working on Internet Explorer #8717

Closed puremana closed 5 years ago

puremana commented 5 years ago

Since I have seen Mapbox GL JS is trying to cater towards IE too, I noticed the directions example located at https://docs.mapbox.com/help/tutorials/getting-started-directions-api/ doesn't work on Internet Explorer due to req.responseType = 'json'; in

var req = new XMLHttpRequest();
req.responseType = 'json';
req.open('GET', url, true);
  req.onload = function() {
  var data = req.response.routes[0];
  var route = data.geometry.coordinates;

This could be changed to

var req = new XMLHttpRequest();
req.open('GET', url, true);
  req.onload = function() {
  var json = JSON.parse(req.response);
  var data = json.routes[0];
  var route = data.geometry.coordinates;

to work on IE.

Was going to change this myself but I couldn't see any repo that included the code for those docs. Thanks

arindam1993 commented 5 years ago

Hi @puremana , thanks a lot for pointing this out. 🙌

Unfortunately the /help pages are in an internal repo, so we can't accept external contributions, sorry :( But we've captured this request in the issue tracker for that repo, and it should be fixed soon.

Closing this to prevent duplication.