fixed ios export
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 29s

This commit is contained in:
Pedan
2025-07-29 17:20:36 +02:00
parent 8b4a8e9539
commit b01743d9c4

View File

@@ -231,15 +231,22 @@ ${latlngs.map(pt => ` <trkpt lat="${pt[0]}" lon="${pt[1]}"></trkpt>`).join(
</trkseg>
</trk>
</gpx>`;
let blob = new Blob([gpx], {type: "application/gpx+xml"});
let url = URL.createObjectURL(blob);
let a = document.createElement('a');
a.href = url;
a.download = "freemoto-route.gpx";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
// iOS workaround: open in new tab instead of triggering download
if (navigator.userAgent.match(/(iPad|iPhone|iPod)/i)) {
window.open(url, '_blank');
} else {
let a = document.createElement('a');
a.href = url;
a.download = "freemoto-route.gpx";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
document.getElementById('exportGpxBtn').addEventListener('click', function() {