简体   繁体   English

从帖子中使用用户脚本更改Content-Disposition文件名

[英]Change Content-Disposition filename with userscript from a Post

I would like to change the file name of a downloaded file from Submit that uses Content-Disposition: attachment; filename=Reports.csv 我想从使用Content-Disposition: attachment; filename=Reports.csv Submit更改已下载文件的文件名Content-Disposition: attachment; filename=Reports.csv Content-Disposition: attachment; filename=Reports.csv

I would like to Download that file with a preset file name Content-Disposition: attachment; filename=AnyFileName.csv 我想下载一个带有预设文件名Content-Disposition: attachment; filename=AnyFileName.csv文件Content-Disposition: attachment; filename=AnyFileName.csv Content-Disposition: attachment; filename=AnyFileName.csv

I would need it to be userscript friendly 我需要它是用户友好的

The Download is Post and the content it returns is Content-Type: application/octet-stream; charset=UTF-8 Download is Post,下载的内容为Content-Type: application/octet-stream; charset=UTF-8 Content-Type: application/octet-stream; charset=UTF-8

I need it to change the filename of the download file 我需要它来更改下载文件的文件名

That's not gonna be easy at all. 那根本不容易。 To do this you will have to: 为此,您将必须:

I'm sory, it's probably much more work than you expected. 我很抱歉,这可能比您预期的要多得多。 Good luck. 祝好运。 You may alternatively consider some add-on or program that tampers with the HTML headers for that particular site. 您也可以考虑使用某些插件或程序来篡改该特定网站的HTML标头。

It would be much easier if you could use the download attribute on <form> , but that's not possible . 如果可以在<form>上使用download属性,则会容易得多, 但这是不可能的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用于从 Content-Disposition 标头中提取文件名的 javascript 正则表达式 - javascript regex for extracting filename from Content-Disposition header XMLHttpRequest 是否阻止了 Content-Disposition 附件? - Is Content-Disposition attachment blocked from XMLHttpRequest? 使用symfony2从邮件Multipart(Content-Disposition:form-data)获取数据 - Get Datas from post Multipart (Content-Disposition: form-data) with symfony2 ajax:发送的帖子上有奇怪的“边界”和“内容处置”名称(没有 jquery!) - ajax: weird "boundary" and "content-disposition" names on post sent (no jquery!) 文件下载过程不会启动客户端(即使使用Content-Disposition:附件; filename = <filename> ) - File download process does not start client side (even with Content-Disposition: attachment ; filename=<filename>) 内容处置始终为 null - Content-Disposition is always null 无法从后端响应获取“ Content-Disposition” - Not able to get the `Content-Disposition` from backend response 如何从内容处置中获取文件名 - How to get file name from content-disposition &quot;Content-Disposition&quot;, &quot;inline;filename=&quot; + filName 不强制显示 pdf 文件 - "Content-Disposition", "inline;filename=" + filName doesnt force pdf files to show 将内容处置与 Axios 和 NodeJS 一起使用 - Use content-disposition with Axios and NodeJS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM