Canvas toDataURL无法正常工作

时间:2016-12-13 14:11:15

标签: javascript canvas

我正在尝试在myownradar.alerteagle.com/comp/800x500/north_carolina.gif上叠加radarchive.neocities.org/legend.png

<html>
<head>
    <title>Canvas</title>
</head>
<body>
    <img style="position: relative; top: 0; left: 0;" src="http://myownradar.alerteagle.com/comp/800x500/north_carolina.gif"> 
    <img style="position: absolute; top: 8; left: 200;" src="http://radarchive.neocities.org/legend.png">
    <script src="https://rawgit.com/niklasvh/html2canvas/master/dist/html2canvas.min.js"></script>
    <script>
        html2canvas( [ document.body ], {
            taintTest: false       
        }).then(function(canvas) {               
            var img = canvas.toDataURL("image/png");
            document.write('<img src="' + img + '" width="800" height="500"/>');
        });            
    </script>
</body>

此处的输出http://radarchive.neocities.org/canvas.html

代码没有将图像url写入页面。
我是否需要使用taintTest函数?

0 个答案:

没有答案