GM_html2canvas

由于原版的html2canvas在对跨域图片获取上总是失败的问题,将跨域改为通过GM_xmlhttpRequest获取

Acest script nu ar trebui instalat direct. Aceasta este o bibliotecă pentru alte scripturi care este inclusă prin directiva meta a // @require https://update.greasyfork.org/scripts/456607/1413244/GM_html2canvas.js

Autor
WhiteSevs
Versiune
0.0.1.20230912061525
Creat
15-12-2022
Actualizat
12-09-2023
Licență
N/A

将跨域改为通过GM_xmlhttpRequest获取

介绍

# 我的设置如下
let options = {
    allowTaint: true,
    logging: true,
    useCORS: true,

}
html2canvas(document.documentElement, options ).then( canvas =>{
  var base64Image = canvas.toDataURL("image/png");

})

如果是自己使用webview定义的GM_xmlhttpRequest,可在onload回调参数中新增一个responseBase64用于图片的base64获取