HTML anchor tag download with CORS

Viewed 1047

I really don't understand how anchor tag downloads should work, I get that when CORS is not enabled I can not do for example this:

<a download href="https://www.NotMyHost.com/foo.mp4">Download Video</a>

but when the access-control-allow-origin: * header is present, this should be doable, right? and if yes, then what is the problem with this tag?

<a download href="https://www.radiantmediaplayer.com/media/big-buck-bunny-360p.mp4">Download Video</a>

the source here has the access-control-allow-origin: * response header, but it still refuses to download.

1 Answers

but when the access-control-allow-origin: * header is present, this should be doable, right?

No. The download attribute is not supported on cross-origin requests.

To trigger a download the server hosting the file should set a Content-Disposition HTTP response header.

Related