• js注入,canvas截图


    拿到画布数据

    document.getElementsByClassName("inner_page")[0] //DOM对象,默认BASE64格式
    document.getElementsByClassName("inner_page")[0].toDataURL("image/jpeg")  //转换成jpeg的BASE64
    

    (引用)注入js,另存为功能

    var script=document.createElement("script");
    script.src="https://superal.github.io/canvas2image/canvas2image.js";
    document.getElementsByTagName('head')[0].appendChild(script);
    

    弹出并下载:

    Canvas2Image.saveAsJPEG(document.getElementsByClassName("inner_page")[0])
    Canvas2Image.saveAsJPEG(document.getElementsByClassName("inner_page")[1]) //手动保存多个
    
  • 相关阅读:
    菜根谭#245
    菜根谭#244
    菜根谭#243
    菜根谭#242
    菜根谭#241
    菜根谭#240
    菜根谭#239
    菜根谭#238
    菜根谭#237
    [转载]Linux 内核list_head 学习(一)
  • 原文地址:https://www.cnblogs.com/scientist/p/15271515.html
Copyright © 2020-2023  润新知