这是src属性下载图像的(Base64) [英] Download image which is src attribute (base64)

查看:223
本文介绍了这是src属性下载图像的(Base64)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过AJAX我收到为Base64形象,我附属物一个img标签的src属性。

through AJAX I receive a image in base64 which I adjunct to the src attribute of a img tag.

我想提供一个选项,以下载图像,是有可能采取src属性的数据,并下载了吗?这是因为我不能再从服务器上下载的图像。

I want to offer an option to download that image, is it possible to take the data of the src attribute and download it? This is because I cannot download the image again from the server.

感谢你。

推荐答案

只需设置 window.location的的EN codeD URI(或打开一个弹出窗口),例如:

Just set the window.location to the encoded URI (or open a popup window), eg

window.location.href = 'data:image/png;base64,iVBORw0KGgo....

这篇关于这是src属性下载图像的(Base64)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆