I guess this isn’t so much a Meteor question as it is a simple HTML question.
I spent countless hours trying to get this to behave the way these clients would like.
Basically, I’m serving a Photoswipe gallery through a Meteor app, and then have a “Download image” feature. The feature works fine in Chrome on all devices. The clients I’m building it for use Firefox on Android, and Safari on iOS. We are anticipating a wide range of app visitors from various devices and various web browsers.
In Firefox and Safari on mobile browsers, instead of downloading the file, the browsers just open the link in a new window. Is there any way to actually download the file to a visitor’s device? On Desktop, it actually prompts to Save the file and download it.
The result of the “Download image” code after processing on the server and client is this in the browser:
<a href="http://localhost:3000/cdn/storage/Images/RGTwXzh5GqqLYm273/original/RGTwXzh5GqqLYm273.jpg?download=true" target="_blank" class="active-download" download="2018-04-29_152223.jpg" type="image/jpeg" style="color: rgb(255, 255, 255);">Download File Now</a>
I tried playing with this a few different ways; like with/without the ?download=true param.
I also looked around the web, and anywhere I can find a “Download image” type button, it’s the same behavior depending on the browser – Firefox/Safari open the image in a new window, Chrome actually downloads the file to a user’s gallery.
I’m assuming it’s impossible to override browser behavior for what it decides to do with jpeg href’s – someone please tell me I’m wrong.
Should I be doing something on the route (flowrouter) with http headers that I just don’t know about?