i have a chart that created with highchart. i need to save svg to png in internet Explorer. i use from follow code and exist security Error in ie11.
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext('2d');
var imgChart = document.createElement('img');
imgChart.setAttribute('src', 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(svg))));
imgChart.onload = function () {
ctx.drawImage(imgChart, 0, 0);
var blobObject = canvas.msToBlob();
window.navigator.msSaveBlob(blobObject, 'save.png');
})
See Question&Answers more detail:os