brouter-web icon indicating copy to clipboard operation
brouter-web copied to clipboard

Downloading routes doesn't work with 3rd party browsers on iOS

Open mjaschen opened this issue 3 years ago • 6 comments

  • downloading a track (GPX, KML, GeoJSON) fails with 3rd part browsers (Firefox, Chrome, Brave, …) on iOS (tested with iOS 14.5)
  • after tapping the export button nothing happens (besides from the progress bar which appears for a short moment)
  • the CSV export is rendered as text file on the mentioned browsers
  • everything works fine in Safari, the browser's download dialog appears for each file type, the download completes successfully after confirming the dialog:

brouter-download-safari

(I'll investigate further, this issue is just a reminder that we have to fix this before creating the next release)

mjaschen avatar May 19 '21 08:05 mjaschen

I forgot to mention that this is an issue with the new export functionality (68-sl-formatting).

mjaschen avatar May 19 '21 08:05 mjaschen

(I'll investigate further, this issue is just a reminder that we have to fix this before creating the next release)

Have you looked further into this?

The code section probably relevant here is this: https://github.com/nrenner/brouter-web/blob/5cc64015b966e0e5e9ae924e629e7f88a843d6a5/js/control/Export.js#L68-L75

nrenner avatar May 23 '22 15:05 nrenner

It seems that this problem persists. Other projects have the same or similar issues, e.g. see this Stackoverflow thread.

Other references:

mjaschen avatar May 24 '22 06:05 mjaschen

Thanks for the links, I also found:

Here is a minimal test page to reproduce (prints browser and feature checks and automatically starts a download):

I don't have access to an iOS device, but tested with a free account on LambdaTest with iPhone 11, iOS 13.3 and could confirm the issue with Firefox.

Several comments [1], [2], [3] suggest a workaround using FileReader.readAsDataURL(blob) instead of URL.createObjectURL(blob), so here is a test page trying that:

Test results with LambdaTest:

  • Firefox didn't work, shows progress bar but nothing else happens, Downloads are empty
  • Chrome did work, downloads with name "document"
  • Leaflet browser detections (L.Browser.chrome/gecko) didn't work, always detected as safari
  • iOS detection worked

Can you confirm that the fix page works in iOS Chrome but not in Firefox?

nrenner avatar May 25 '22 16:05 nrenner

Can you confirm that the fix page works in iOS Chrome but not in Firefox?

Yes, I can confirm that.

Works in

  • Safari
  • Chrome

Doesn't work in:

  • Firefox
  • Brave

Tested with iOS 15.4.1 and latest versions of Chrome, Firefox and Brave.

mjaschen avatar May 27 '22 15:05 mjaschen

Thanks for testing. Offering download from server as an alternative for now, currently for all as a fallback in case of other bugs.

nrenner avatar Jun 01 '22 14:06 nrenner