so on a site that when you hit download, it always asks for a filename when I use a shortcut key to download something - ie it comes up with the "save as" dialog. I want to build a chrome extension to trap that and provide my own filename.
I'm fine with building the extension, I've built lots, but I can't figure out how to trap/inject code into the "save as" dialog. [and it generates a dynamic and complicated url that I can't predict, so I can't download from JS]
Is that possible to do?
I think the answer is "it depends". This page might offer a clue.
If it's an anchor, it looks like a download
attribute with a value will be used as the suggested file name.
But then there is this:
Note: if the Content-Disposition header has different information from the download attribute, resulting behavior may differ: If the header specifies a filename, it takes priority over a filename specified in the download attribute.
It might be possible to fiddle with that. Looks like this guy did it on Firefox .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.