<a> download attribute not working anymore

谁说胖子不能爱 提交于 2019-12-31 03:12:29

问题


I used to use this code to download resources:

<a href='http://example.com' download> Download </a>

Where example.com is another website (cross origin).

But this is not working now , I tried Chrome - Opera - Mozilla and even Internet Explorer , But it's not working.


回答1:


See https://caniuse.com/#search=download ("Known Issues" Tab) where it says:

Firefox only supports same-origin download links.

Chrome 65 and above only supports same-origin download links.

IE does not support the download-attribute at all




回答2:


I figured out a workaround for downloading images cross-origin. You may be able to modify this to work with other media types. Hope this helps Force browser to download image files on click




回答3:


All major browsers have implemented this as a security guard for the user. In addition it is stated in the HTML spec (link to chrome feature)



来源:https://stackoverflow.com/questions/49760160/a-download-attribute-not-working-anymore

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