超链接下载属性不起作用 [英] 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'.
另一方面,如果我具有完整的uri格式的链接:
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>
它会将我重定向到页面,它将仅显示文件.怪异的 事情是当我在mozilla和勇敢的浏览器上尝试过时.有用.但 在Safari中使用,我的默认设置是google chrome.它不起作用.
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.
推荐答案
事实证明,我的问题与相同的原始url冲突.适当地,我正在从不同的主机/站点进行请求,有关更多说明,请参见:
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
这篇关于超链接下载属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!