当用户单击网页上的图像时,我想触发浏览器的“保存图像”对话框并让用户将图像保存在他们的硬盘上。有没有一种跨浏览器的方法可以使用 jQuery/Javascript 来做到这一点?
最佳答案
不准确,但您可以通过超链接到 img 文件并在服务器响应中设置 content-type 和 content-disposition header 来实现。尝试,例如,application/x-download,plus the other headers specified here .
关于javascript - 使用 jQuery/Javascript 打开“保存图像”对话框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/399486/