From 4ba0ce28dde2670e1bd9266df7663bc9e4c97edf Mon Sep 17 00:00:00 2001 From: Manfred Stock Date: Sun, 8 Apr 2018 22:13:07 +0200 Subject: [PATCH] Add workaround for issues with GPX generation in IE11 This works around JXON issue #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] https://github.com/tyrasd/jxon/issues/42 --- src/tools.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools.js b/src/tools.js index 5c09277..9dc1f4e 100644 --- a/src/tools.js +++ b/src/tools.js @@ -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);