Skip to content

Commit

Permalink
Add workaround for issues with GPX generation in IE11
Browse files Browse the repository at this point in the history
This works around JXON issue Project-OSRM#42 [1] by repairing the invalid XML name
space declarations in the GPX data and should thus yield usable GPX files
in IE11, too.

[1] tyrasd/jxon#42
  • Loading branch information
mstock committed Apr 8, 2018
1 parent f244fa9 commit 4ba0ce2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ var Control = L.Control.extend({
_downloadGPX: function() {
if (this.routeGeoJSON) {
var gpxData = togpx(this.routeGeoJSON);
// Work around issues with XML name space generation in IE 11
// (see also https://github.com/tyrasd/jxon/issues/42)
gpxData = gpxData.replace(/\s+xmlns:NS\d=""/g, '');
gpxData = gpxData.replace(/NS\d:/g, '');
var blob = new Blob([gpxData], {
type: 'application/gpx+xml;charset=utf-8'
}, false);
Expand Down

0 comments on commit 4ba0ce2

Please sign in to comment.