<div id="forAppend" class="demo"></div>
<script>
    var eleAppend = document.getElementById("forAppend");
    window.URL = window.URL || window.webkitURL;
    if (typeof history.pushState == "function") {
        var xhr = new XMLHttpRequest();
        xhr.open("get", "test/images/1.gif", true); xhr.responseType = "blob"; xhr.onload = function() { 

if (this.status == 200) { var blob = this.response; var img = document.createElement("img"); img.onload = function(e) {
window.URL.revokeObjectURL(img.src);
// 清除释放 }; img.src = window.URL.createObjectURL(blob); eleAppend.appendChild(img); } }
xhr.send();
}

else {
eleAppend.innerHTML
= '<p style="color:#cd0000;">浏览器不给力,请更换浏览器后重试</p>';
}

</script>

 

相关文章:

  • 2021-07-08
  • 2022-01-08
  • 2022-01-19
  • 2021-12-15
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-01
  • 2021-08-09
  • 2021-05-31
  • 2021-07-26
  • 2021-10-18
  • 2022-12-23
相关资源
相似解决方案