From a1af69a44ccbaf7808c415a7e03086cf45860129 Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Tue, 4 Aug 2020 11:13:24 +0200 Subject: [PATCH] Prevent submit action to avoid side effects (#328) Otherwise the download is blocked and a `/?format=gpx#` query is added to the URL in Chromium. --- js/control/Export.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/control/Export.js b/js/control/Export.js index f32aaea..fd6b69c 100644 --- a/js/control/Export.js +++ b/js/control/Export.js @@ -41,7 +41,7 @@ BR.Export = L.Class.extend({ } }, - _export: function() { + _export: function(e) { var exportForm = document.forms['export']; var format = exportForm['format'].value || $('#export-format input:radio:checked').val(); var name = encodeURIComponent(exportForm['trackname'].value); @@ -49,6 +49,8 @@ BR.Export = L.Class.extend({ var uri = this.router.getUrl(this.latLngs, this.pois.getMarkers(), format, name, includeWaypoints); + e.preventDefault(); + var evt = document.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); var link = document.createElement('a');