Force file download from HTTP on iOS

别来无恙 提交于 2019-12-25 11:53:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!