fixed ios export
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 29s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 29s
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user