问题
I am using a link to auto download file once clicked. This download is working all fine in Android and Windows.
But on MAC and iOS the file is opening in browser only. It is not downloading.
I'm setting below response headers:
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="filename.csv"
I checked on SO and some suggested to use
Content-Type: application/force-download
But it is Hack, not a standard as per comments. So how can I achieve download in iOS and MAC?
回答1:
It's supported in iOS Safari from v13.1 onwards. See here: https://caniuse.com/#feat=download
In your content-type header you can
来源:https://stackoverflow.com/questions/33886885/force-file-download-from-http-on-ios