alkissack / Dump1090-OpenLayers-html

Modifications to the Openlayers html files (part of the dump1090-fa branch)
GNU General Public License v2.0
44 stars 20 forks source link

Range json files and different browsers #19

Closed clwgh closed 11 months ago

clwgh commented 11 months ago

Myself and a friend have been playing with the Export Ranges feature. It turns out that different browsers are handling this in different ways.

Firefox saves all 3 files: minRange.json, midRange.json and maxRange.json.

Safari usually saves just minRange.json, but sometimes saves just midRange.json

Chrome prompts to save one of the files and then pops up a window asking to save or cancel the remaining "multiple files".

In the case of Safari, I found a similar post which implied that if the downloads are too quick in succession, Safari doesn't respond to all of them. I think this is what is happening here. It was suggested that a short delay between the files can mitigate that.

It may also mitigate the effect on Chrome, which appears to be treating the succession of downloads as something potentially threatening, something it doesn't do for single file downloads with a short delay between them.

I took a look at the code and am not sure where a delay might be introduced, because it seems that all three files are formed and downloaded horizontally as part of the same logic in a single function.

Is it possible to add a short delay, for example 1 second, between each file being downloaded please? I think this would fix Safari's handling and may also keep Chrome from prompting.

Alternatively, instead of having a single Export Ranges button, having a button for each range type should work, each linking to a function just for that range type. But that is not as pretty but would be functional and foolproof since we can then just save whichever range type we want at a given time.

On a related note, your own range plots are present in the backup directory, maybe left over from testing.

alkissack commented 11 months ago

@clwgh Chris. I've added a 5 second delay. It looks okay in Opera, can you have a look in Safari etc - thanks

clwgh commented 11 months ago

Thanks for the tweak, this is now working great.

Safari 15.6 (Mac) - files now download one after the other (previously only one file manages to download) Firefox latest (Linux) – files download one after the other Chrome latest (Win 10) - first file downloads then Chrome asks if additional files can be downloaded. If allowed then the site is flagged as okay for multiple files and all the files download one after the other, this time and on subsequent uses MS Edge (Win 10) - exactly the same behaviour as Chrome

alkissack commented 11 months ago

@clwgh Thanks for that testing Chris