Saving skin dose maps as an image doesn't work in Internet Explorer or Edge

Issue #375 resolved
David Platten created an issue

This should work, I think, but doesn't. I'm using the toDataURL() of the canvas (2d) or renderer (3d). It works fine in Chrome and Firefox.

Does anyone have any ideas?

function downloadCanvas(link, canvasId, filename) {
    link.href = document.getElementById(canvasId).toDataURL();
    link.download = filename;
}

function download3dCanvas(link, filename) {
    link.href = renderer.domElement.toDataURL('image/png');
    link.download = filename;
}

document.getElementById('save2dSkinMap').addEventListener('click', function() {
    downloadCanvas(this, 'skinDoseMap', '2dSkinMap.png');
}, false);

document.getElementById('save3dSkinMap').addEventListener('click', function() {
    download3dCanvas(this, '3dSkinMap.png');
}, false);

Comments (4)

  1. Ed McDonagh

    Weird that Edge doesn't behave like the others do - you would expect it from IE. I hope the SO helps to fix it, as I've no ideas without doing the research you'll have already done.

  2. Log in to comment