简体   繁体   English

html2canvas无法捕获验证码图像

[英]html2canvas can not capture captcha images

Here is the html codes : 这是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"/>

And here is jquery codes : 这是jQuery代码:

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

And here is the jsFiddle link 这是jsFiddle链接

How can i capture such these captcha images using with html2canvas or other ways? 如何使用html2canvas或其他方式捕获此类验证码图像?

According to HTML2Canvas documentation, you are able to use the allowTaint and taintTest configurations to allow cross-origin images. 根据HTML2Canvas文档,您可以使用allowTainttaintTest配置来允许跨域图像。

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

Detect and remove the captcha on the original page before running html2canvas . 检测和删除captcha运行前的原始页面上html2canvas

Many implimentations of captcha's will have cross-domain content that will taint the canvas. 验证码的许多实现方式将具有跨域内容,这些内容会弄脏画布。 Tainting a canvas will automatically prevent html2canvas from capturing the page... 给画布着色会自动阻止html2canvas捕获页面...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM