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!


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



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


If you look at here https://www.w3schools.com/TagS/tag_a.asp

Scroll down to attributes, and you will see that the DOWNLOAD attribute is only supported by HTML5, which, as it seems, your friend's version of Safari does not support. I recommend updating the program.

Alternatively, you can right-click on the download link, then click Save As..., then download it that way.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.