HTML:强制下载磁盘系统上的文件

时间:2021-06-03 12:37:11

标签: html

在磁盘上有一个带有 html 文件的文件集合来索引它们我想强制浏览器(Chrome)下载文件而不是简单地尝试打开它们(适用于 txt、stp 和 pdf)

在以下文章中: (HTML) Download a PDF file instead of opening them in browser when clicked 据说“下载”属性只是为了添加,但这不适用于没有任何Web服务器的Windows磁盘系统。

结构如下:

<a href="data:text/plain;charset=utf-8;content-disposition:attachment;./01/02/asm_file.stp" target="_blank"  download="asm_file.stp">3D file</a>

导致空文件/网络文件错误。有什么好主意吗?

0 个答案:

没有答案