我想将html2canvas与ie8结合使用。我搜索并找到了使用html2canvas的闪光灯画布。但是,我在文件html2canvas.js中有一个问题。每次调用函数loadPseudoElement时:
function loadPseudoElement(element, type) {
var style = window.getComputedStyle(element, type),
content = style.content;
if (content.substr(0, 3) === 'url') {
methods.loadImage(_html2canvas.Util.parseBackgroundImage(content)[0].args[0]);
}
loadBackgroundImages(style.backgroundImage, element);
}在"var style = window.getComputedStyle(element,type)“行中出现一个错误。
显然,getComputedStyle不是由ie8处理的。我试过这样做:
var style = null;
if (window.getComputedStyle) {
style = window.getComputedStyle(element, type);
}
else {
style = element.currentStyle;
}
var content = style.content;但还是不起作用。
我调用html2canvas和flashcanvas画布的JS代码是:
function test(){
html2canvas($('#contentBody'), {
onrendered: function (canvas) {
if (typeof FlashCanvas != "undefined") {
FlashCanvas.initElement(canvas);
}
var img = canvas.toDataURL("image/png");
var newImg = window.open(img);
}
});
return false;
}你能帮帮我吗?
谢谢。
发布于 2013-11-07 20:58:55
html2canvas所依赖的东西太多了,以至于IE8或更低的版本不支持它,所以您会发现它几乎不可能在IE8上工作。
https://stackoverflow.com/questions/19771412
复制相似问题