Open the Save Image dialog using jQuery/Javascript?

后端 未结 5 371
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 16:10

When a user clicks on an image on a web page, I\'d like to trigger the browser\'s Save Image dialog and to let the user save the image on their hard drive. Is there a cross-

5条回答
  •  生来不讨喜
    2020-12-05 16:47

    Not precisely, but you can do it by hyperlinking to the img file and setting the content-type and content-disposition headers in the server response. Try, e.g., application/x-download, plus the other headers specified here.

提交回复
热议问题