美文网首页
前端接收,text/html类型 的图片流

前端接收,text/html类型 的图片流

作者: 奋斗滴猩猩 | 来源:发表于2019-04-11 11:54 被阅读0次
    image.png

    <div class="headL"></div>
    <script>
    var xhr=new XMLHttpRequest();
    xhr.open("GET","图片URL",true);
    xhr.responseType = "blob";
    xhr.onload = function () {
    var blob = this.response;
    var img = document.createElement("img");
    img.onload = function (e) {
    window.URL.revokeObjectURL(img.src);
    };
    img.src = window.URL.createObjectURL(blob);
    $(".headL").html(img);
    }
    xhr.send();
    </script>

    相关文章

      网友评论

          本文标题:前端接收,text/html类型 的图片流

          本文链接:https://www.haomeiwen.com/subject/ygqtwqtx.html