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>
|
</trkseg>
|
||||||
</trk>
|
</trk>
|
||||||
</gpx>`;
|
</gpx>`;
|
||||||
|
|
||||||
let blob = new Blob([gpx], {type: "application/gpx+xml"});
|
let blob = new Blob([gpx], {type: "application/gpx+xml"});
|
||||||
let url = URL.createObjectURL(blob);
|
let url = URL.createObjectURL(blob);
|
||||||
let a = document.createElement('a');
|
|
||||||
a.href = url;
|
// iOS workaround: open in new tab instead of triggering download
|
||||||
a.download = "freemoto-route.gpx";
|
if (navigator.userAgent.match(/(iPad|iPhone|iPod)/i)) {
|
||||||
document.body.appendChild(a);
|
window.open(url, '_blank');
|
||||||
a.click();
|
} else {
|
||||||
document.body.removeChild(a);
|
let a = document.createElement('a');
|
||||||
URL.revokeObjectURL(url);
|
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() {
|
document.getElementById('exportGpxBtn').addEventListener('click', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user