Skip to content
Advertisement

A hyperlink download attribute not working

so i have this problem with hyperlink attribute download. basically i have link that download a certain file. however it doesnt work..

<a href="somelink/somefile.txt" download="" class="external">download file</a>

With this format, it will download the file but it will give me an failed file says ‘no file’.

On the other hand if i have link that has a complete uri format:

<a href="http://wwww.somesite.com/somelink/somefile.txt" download="" class="external">download file</a>

It redirects me to the page and it will just show the file. The weird thing is when I tried it on mozilla and brave browser. it works. but in safari, and my default is google chrome. its not working..

Am I missing something? maybe in my header? really appreciate if you can help.. thanks!

EDITED

also, i’ve read this stuff about content disposition, so how do i know that my webpage set as inline for that matter. enter image description here

Advertisement

Answer

it turns out, my problem is conflicted by same origin urls. Apprently, I am rquesting from different hosts/site, for further explanation see : https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement