<small id='SQ1ty'></small><noframes id='SQ1ty'>

    • <bdo id='SQ1ty'></bdo><ul id='SQ1ty'></ul>
    <tfoot id='SQ1ty'></tfoot>
  1. <legend id='SQ1ty'><style id='SQ1ty'><dir id='SQ1ty'><q id='SQ1ty'></q></dir></style></legend>
    1. <i id='SQ1ty'><tr id='SQ1ty'><dt id='SQ1ty'><q id='SQ1ty'><span id='SQ1ty'><b id='SQ1ty'><form id='SQ1ty'><ins id='SQ1ty'></ins><ul id='SQ1ty'></ul><sub id='SQ1ty'></sub></form><legend id='SQ1ty'></legend><bdo id='SQ1ty'><pre id='SQ1ty'><center id='SQ1ty'></center></pre></bdo></b><th id='SQ1ty'></th></span></q></dt></tr></i><div id='SQ1ty'><tfoot id='SQ1ty'></tfoot><dl id='SQ1ty'><fieldset id='SQ1ty'></fieldset></dl></div>
    2. 如何下载 base64 编码的图像?

      How to download a base64-encoded image?(如何下载 base64 编码的图像?)
          <tfoot id='gHGma'></tfoot>

          <i id='gHGma'><tr id='gHGma'><dt id='gHGma'><q id='gHGma'><span id='gHGma'><b id='gHGma'><form id='gHGma'><ins id='gHGma'></ins><ul id='gHGma'></ul><sub id='gHGma'></sub></form><legend id='gHGma'></legend><bdo id='gHGma'><pre id='gHGma'><center id='gHGma'></center></pre></bdo></b><th id='gHGma'></th></span></q></dt></tr></i><div id='gHGma'><tfoot id='gHGma'></tfoot><dl id='gHGma'><fieldset id='gHGma'></fieldset></dl></div>

          <legend id='gHGma'><style id='gHGma'><dir id='gHGma'><q id='gHGma'></q></dir></style></legend>
            <tbody id='gHGma'></tbody>

          <small id='gHGma'></small><noframes id='gHGma'>

            • <bdo id='gHGma'></bdo><ul id='gHGma'></ul>
                本文介绍了如何下载 base64 编码的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个来自服务器的 base64 编码图像,我想通过 JavaScript 强制下载该图像.有可能吗?

                I have a base64-encoded image from the server for which I want to force the download through JavaScript. Is is possible?

                推荐答案

                1. 如果您想使用 JavaScript(没有任何后端)下载它,请使用:

                1. If you want to download it using JavaScript (without any back-end) use:

                window.location.href = 'data:application/octet-stream;base64,' + img;
                

                其中 img 是您的 base64 编码图像.

                where img is your base64 encoded image.

                如果要允许用户指定文件名,请使用 a 标签的 download 属性:

                If you want to allow the user to specify a file name, use the download attribute of the a tag:

                <a download="FILENAME.EXT" href="data:image/png;base64,asdasd...">Download</a>
                

                • 注意:非常旧的浏览器不支持下载属性
                • 这篇关于如何下载 base64 编码的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                Ordinals in words javascript(javascript中的序数)

                  <tbody id='O0qlb'></tbody>
                  <i id='O0qlb'><tr id='O0qlb'><dt id='O0qlb'><q id='O0qlb'><span id='O0qlb'><b id='O0qlb'><form id='O0qlb'><ins id='O0qlb'></ins><ul id='O0qlb'></ul><sub id='O0qlb'></sub></form><legend id='O0qlb'></legend><bdo id='O0qlb'><pre id='O0qlb'><center id='O0qlb'></center></pre></bdo></b><th id='O0qlb'></th></span></q></dt></tr></i><div id='O0qlb'><tfoot id='O0qlb'></tfoot><dl id='O0qlb'><fieldset id='O0qlb'></fieldset></dl></div>
                  <legend id='O0qlb'><style id='O0qlb'><dir id='O0qlb'><q id='O0qlb'></q></dir></style></legend>
                • <small id='O0qlb'></small><noframes id='O0qlb'>

                • <tfoot id='O0qlb'></tfoot>

                        <bdo id='O0qlb'></bdo><ul id='O0qlb'></ul>