I'm using Firefox 81 (and also 82 dev edition), and I'd like to be able to save the images on the page that has finished loading without sending another GET request. This is because:
- I don't want to wait for it to get downloaded again on a slow enough connection where it gets rather annoying,
- It may not get downloaded again using the same url due to overprotective coding of the page (one-time url tokens),
- The site may temporarily block me from using it, due to excessive security measures. Such are the internal business sites.
Making screenshots of a page is not a good option because images are often larger than the screen and require zooming in to view the full contents (like giant Gantt graphs and waterfall diagrams).
For whatever reason, some of the images on the page can be viewed via "View Page Info > Media tab" but even though the image that I want to save is displayed right there, it says that its size is "Unknown (not cached)". And when I attempt to save it by pressing "Save As..." the download tab shows that the file failed to download or it's 0 bytes long (just like the normal right click on the image and "Save image as"), and if I examine the GET response, it appears that Firefox didn't try to save it from memory or cache, but attempted to get it again, and sometimes it does not work.
Because legacy methods and extensions/addons are not compatible with modern Firefox versions, I'm asking for a modern day method of saving images which have already been downloaded and are displayed on a page. Is there a button in some menu for this? Is there a pure javascript function? Or maybe a userscript GM_something method? Or maybe an addon-only function that works in Firefox 81?
I could work with either a direct "Save to file" button or a function that returns a binary array of the original file, or a base64 string of it. I am aware of a method using canvas, but due to CSP/CORS it is usually impossible to send the resulting canvas bytes, and even when it works, the file is usually larger because it's not the original but the canvas redrawn version, and I'd like to get the original file if possible.
GM.xmlHttpRequest