html - 设置内联文件的标题?

标签 html http-headers filenames

我通过设置标题 Content-disposition 强制浏览器处理下载至 inline;
有没有办法以这种方式设置标题?目前看起来浏览器会用文件的 URL 自动填充它。

最佳答案

有可能,只需在 URL 的末尾包含文件名,确保对其进行 URLEncode,大多数浏览器会忽略 queryStringlocalhost:3000/blah/blah/blah/Attachment%3A%20Screen%20Shot.png/?id=1670674338147205293标签显示 = "附件:屏幕截图.png"
在 Chrome、Firefox 和 Opera 上运行良好。 . . Safari 根据您的设置显示域或整个 URL

关于html - 设置内联文件的标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21789851/

相关文章:

apache - 416 请求的范围不可满足

python - Django 唯一文件名方法

perl - Perl 中的 glob() 函数用于获取文件名

linux - 如何使用 bash 脚本替换文件名中的空格

javascript - 使用 jQuery 传递元素事件?

html - 是否有 HTML 属性告诉智能手机键盘显示特殊的电子邮件键?

javascript - 如何将对象传递给AngularJS中的指令?

html - 正则表达式 : checking if string has 1 to 6 digits, 和恰好 4 个特殊字符

php - PHP 中的 header 会覆盖 HTTP 响应代码

wordpress - 将 http header 添加到 wordpress