Safari ignores the download directive and treats the tag metioned below as a standard href and open it. This makes posting a file dialog to the user from html element.click() impossible. The only method is to option click or right click and do "Download Link As..." on an existing link.
If the user forgets to hold down option, then that Safari opens the file. Even disabling the preference to automatically open "safe" files, Safari still opens them. It also unzip's zip archives. This would be allevieated by providing download support above, since then the proper file dialog behavior from Chome/Firefox would occur.
----------------------------------------
Repost from the archives... This was posted (and unanswered) back in May of 2015.
I'm trying to allow the user to save a dynamically generated 'file'.
What I have works in Chrome/OSX, Chrome/Ubuntu, and Firefox/Ubuntu. The user is presented with a browser 'save file' dialog. Not so on Safari, which displays the content of the 'file'.
The element I am generating is like this:
<a download="file.json" href="data:application/octet-stream,...."></a>
I create that, then add it to the document body, click it, and then remove it.
How can I get Safari to behave the same as the other browsers?