请知悉:本文最近一次更新为 11个月 前,文中内容可能已经过时。

有个比较少见的需求,我需要自行保存网页中的图片,但是另存为很麻烦,所以考虑用脚本实现。

最终,我是通过使用Tampermonkey,让浏览器实现了自动保存图片的功能。

示例代码:

// ==UserScript==
// @name New Userscript
// @namespace https://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http*://*/*
// @grant GM_download
// ==/UserScript==


var arg = { url: "https://example.com/123456.jpg",
name: "CustomFileName.jpg"
};

GM_download(arg);

参考资料

Save images to hard disk WITHOUT prompt?


如您从本文得到了有价值的信息或帮助,请考虑扫描文末二维码捐赠和鼓励。

尊重他人劳动成果。转载请务必附上原文链接,我将感激不尽。


与《浏览器如何自动保存图片》相关的博文:


留言

avatar
😀
😀😁😂😅😭🤭😋😘🤔😰😱🤪💪👍👎🤝🌹👌