首页 > 其他分享 >使用html2Canvas截图网页时,网页存在图片报错:Tainted canvases may not be exported

使用html2Canvas截图网页时,网页存在图片报错:Tainted canvases may not be exported

时间:2024-02-21 15:22:53浏览次数:19  
标签:canvases .--- canvas 网页 跨域 Whether boolean 报错 images

 这是因为图片跨域产生的报错,看有的说法可以把所有图片进行允许跨域配置,但是比较麻烦。

html2canvas有参数可以配置是否允许跨域

 

参数名称类型默认值描述
allowTaint boolean false Whether to allow cross-origin images to taint the canvas---允许跨域
background string #fff Canvas background color, if none is specified in DOM. Set undefined for transparent---canvas的背景颜色,如果没有设定默认透明
height number null Define the heigt of the canvas in pixels. If null, renders with full height of the window.---canvas高度设定
letterRendering boolean false Whether to render each letter seperately. Necessary if letter-spacing is used.---在设置了字间距的时候有用
logging boolean false Whether to log events in the console.---在console.log()中输出信息
proxy string undefined Url to the proxy which is to be used for loading cross-origin images. If left empty, cross-origin images won't be loaded.---代理地址
taintTest boolean true Whether to test each image if it taints the canvas before drawing them---是否在渲染前测试图片
timeout number 0 Timeout for loading images, in milliseconds. Setting it to 0 will result in no timeout.---图片加载延迟,默认延迟为0,单位毫秒
width number null Define the width of the canvas in pixels. If null, renders with full width of the window.---canvas宽度
useCORS boolean false Whether to attempt to load cross-origin images as CORS served, before reverting back to proxy--这个我也不知道是干嘛的

标签:canvases,.---,canvas,网页,跨域,Whether,boolean,报错,images
From: https://www.cnblogs.com/heyiping/p/18025291

相关文章

  • npm 报错 npm ERR! request to https://registry.npm.taobao.org/three failed, reaso
    1.问题描述npm使用淘宝镜像安装报错npmERR!codeCERT_HAS_EXPIREDnpmERR!errnoCERT_HAS_EXPIREDnpmERR!requesttohttps://registry.npm.taobao.org/xxxfailed,reason:certificatehasexpired2.错误原因错误提示已经告诉原因是淘宝镜像过期了!其实,早在2021......
  • mysql服务启动报错:本地计算机上的mysql服务启动后停止,某些服务在未由其他服务或程序启
    报错如下: 解决办法:1.开始->cmd->以管理员身份运行目录切换到C:\ProgramFiles\MySQL\MySQLServer5.7\bin2.运行mysqld--initialize-insecure--user=mysql说明:初始化后,root密码位空3.运行netstartmysql 三、修改mysql57的root密码[2]四、参考[1] mysql服务启......
  • 通过ata硬盘报错查找对应硬盘
    通过ata硬盘报错查找对应硬盘查看报错dmesg|greperror[2349121.449762]ata8.00:error:{ABRT}res51/04:00:00:80:98/00:00:00:00:00/afEmask0x1(deviceerror)[2349793.559822]ata8.00:error:{ABRT}res51/04:00:00:80:98/00:00:00:00:00/a......
  • 系统表不存在执行升级(mysql_upgrade)操作报错误的解决办法(5.6升级到5.7)
    环境:OS:Centos7原db:5.6新db:5.7 执行升级命令报如下错误[root@hadoop-slave1mysql]#/home/middle/mysql57/bin/mysql_upgrade-s-hlocalhost-pyeemiao3040-P13306-S/home/middle/mysql57/data/mysql.sockmysql_upgrade:[Warning]Usingapasswordonthecomma......
  • Flask 学习100-Flask-SocketIO 结合 xterm.js 实现网页版Xshell
    前言xterm.js是一个使用TypeScript编写的前端终端组件,可以直接在浏览器中实现一个命令行终端应用。可以实现web-terminal功能,类似于Xshell操作服务器。Flask-SocketIO快速入门与使用基础参考前面这篇https://www.cnblogs.com/yoyoketang/p/18022139前后端交互前端代码......
  • javac不报错但不生成文件
    使用场景:在命令行cmd使用命令javac、java运行java程序,结果报错“错误:找不到或无法加载主类”后来发现javac虽然没有报错但是也没有生成对应的class文件解决方案:https://blog.csdn.net/qq_41999034/article/details/111604649我将环境变量放到最上面之后重启,发现在cmd中运行jav......
  • SVN报错“Failed to run the WC DB work queue associated with”解决办法
    最近在checkSVN上的iOS代码时,失败报错:  FailedtoruntheWCDBworkqueueassociatedwith“目录/文件”,cleanup同样报错。最后在网上找到了解决方案并解决了问题,解决方法如下:一、安装sqlite31下载我是window1032位,下载以下文件:1.下载 sqlite-dll-win32-x86-......
  • nginx启动报错:ngx_http_image_filter_module.so" version 1016001 instead of 1022001
    问题现象,启动nginx,提示版本不对[root@k8s-test-node2modules]#/data/nginx/sbin/nginxnginx:[emerg]module"/usr/lib64/nginx/modules/ngx_http_image_filter_module.so"version1016001insteadof1022001in/usr/share/nginx/modules/mod-http-image-filter.conf:1......
  • uniapp编译成微信小程序报错-Component is not found in path "components/canvaspage
     问题:我需要将components/canvaspagebg/index引入进pages/index/index   报错了pages/index/index页面引入: uni-app程序编译成微信小程序后,组件无法显示,控制台报错,错误信息为: 我查看了路径,是对的看网上的解决办法就是 我取消勾选后刷新页面就可以了,此时我在选中......
  • 云电脑Win7系统安装报错详解:问题与解决方案
    本文分享自天翼云开发者社区《云电脑Win7系统安装报错详解:问题与解决方案》,作者:每日知识小分享随着云计算技术的快速发展,越来越多的人开始使用云电脑。然而,在为云电脑安装Win7系统时,一些用户可能会遇到各种安装错误。本文将详细介绍在云电脑Win7系统安装过程中可能出现的报错,分析......