zoukankan      html  css  js  c++  java
  • //保存到相册

     //保存到相册
     function savePic(){   
         debugger      
        // var picurl= $("#picurl").attr("src");
          let picurl= window.sessionStorage.getItem('imgUrl');
        alert(  window.sessionStorage.getItem('imgUrl'));
        savePicture(picurl);
    }


    var triggerEvent = "touchstart";
    function savePicture(Url){
        debugger
        var blob=new Blob([''], {type:'application/octet-stream'});
        var url = URL.createObjectURL(blob);
        var a = document.createElement('a');
        a.href = Url;
        a.download = Url.replace(/(.*/)*([^.]+.*)/ig,"$2").split("?")[0];
        var e = document.createEvent('MouseEvents');
        e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        a.dispatchEvent(e);
        URL.revokeObjectURL(url);
    }
     //保存到相册
     function savePic(){   
         debugger      
        // var picurl= $("#picurl").attr("src");
          let picurl= window.sessionStorage.getItem('imgUrl');
        alert(  window.sessionStorage.getItem('imgUrl'));
        savePicture(picurl);
    }


    var triggerEvent = "touchstart";
    function savePicture(Url){
        debugger
        var blob=new Blob([''], {type:'application/octet-stream'});
        var url = URL.createObjectURL(blob);
        var a = document.createElement('a');
        a.href = Url;
        a.download = Url.replace(/(.*/)*([^.]+.*)/ig,"$2").split("?")[0];
        var e = document.createEvent('MouseEvents');
        e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        a.dispatchEvent(e);
        URL.revokeObjectURL(url);
    }
  • 相关阅读:
    周末复习所接触到的知识点
    新增一些需要记住的知识点和坑
    讨厌烦人的编码问题''
    dictionary 字典相关操作
    一些列表的基础知识和操作
    简单字符串语句
    一些简单的str语句
    c#学习之前言
    第六课时之HTML标题
    第五课时之HTML属性
  • 原文地址:https://www.cnblogs.com/onesea/p/13229869.html
Copyright © 2011-2022 走看看