html2canvas无法捕获验证码图像 [英] html2canvas can not capture captcha images

查看:185
本文介绍了html2canvas无法捕获验证码图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是html代码:

<div id="divPage">
div_Page
<br/>
<img id="captchaimglogin" src="https://www.emirates.com/account/english/login/login.aspx?cptLogin_captcha=86e2a65e-f170-43b6-9c87-41787ff64a35&t=88d296b19e5e8000&mode=ssl" border="0" />
</div>
<br/>
<input type="button" id="btnSave" value="Save PNG"/>

这是jquery代码:

And here is jquery codes :

$(function() {
    $("#btnSave").click(function() { 
        html2canvas($("#divPage"), {
            onrendered: function(canvas) {
                document.body.appendChild(canvas);
               }
         });
         html2canvas($("#btnSave"), {
            onrendered: function(canvas) {
                document.body.appendChild(canvas);
               }
         });
    });
}); 

这是 jsFiddle 链接

如何使用 html2canvas 或其他方式捕获此类验证码图像?

How can i capture such these captcha images using with html2canvas or other ways?

推荐答案

根据 HTML2Canvas 文档,您就可以使用allowTainttaintTest配置来允许跨源图像.

According to HTML2Canvas documentation, you are able to use the allowTaint and taintTest configurations to allow cross-origin images.

onrendered: function(canvas) {
            document.body.appendChild(canvas);
           },
allowTaint: true,
taintTest: false

这篇关于html2canvas无法捕获验证码图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆