• //保存到相册


     //保存到相册
     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);
    }
  • 相关阅读:
    由群里在职的同学给出污染物推断题想到的
    参考文献期刊和会议的缩写
    并行程序开发笔记
    对有关推理方法的理解---支离破碎篇
    改基金的困惑与无奈
    对生物信息学基础的补习
    DPI深度报文检测架构及关键技术实现
    OSGi 和 C++
    CentOS安装glibc-2.14,错误安装libc.so.6丢失急救办法
    误删除libc.so.6的解决方法
  • 原文地址:https://www.cnblogs.com/onesea/p/13229869.html
Copyright © 2020-2023  润新知