Cross-domain issues are also reported when using local images to generate screenshots.
<p id="navp">
<a onClick="testFun();">
<p class="title-msg">美的国际支持部美国加利福尼亚州综合统计报表</p>
<p>
<img id="imgTest" src="images/worldMap.png">
</p>
</a>
</p>
html2canvas(document.getElementById('navp'),{
allowTaint:true,
height: 500
}).then(function(canvas) {
var aTag = document.createElement("a");
aTag.innerHTML = "This is a test";
aTag.setAttribute("href", canvas.toDataURL());
aTag.setAttribute("download", "myPic.png");
document.body.appendChild(aTag);
});
给我你的怀抱2017-05-16 13:46:33
http://stackoverflow.com/ques...
To use canvas to read images, it is best to start a local web service to start this page (otherwise it is considered cross-domain). Don't just open the local html file with the browser.