Download canvas to Image in IE using Javascript -


The code below will convert the canvas to the image and will be downloaded to other browsers other than IE (I'm using IE9 Am). IE code opens datetime in new tab. But, this is not downloadable.

  if (navigator.pagename == "Microsoft Internet Explorer") {somehtml1 = document.createElement ("img"); Somehtml1.id = "imgid"; Somehtml1.name = "imgname"; Somehtml1.src = canvas.toDataURL ("image / png"); Document.body.appendChild (somehtml1); Window.win = Open (somehtml1.src); SetTimeout ('win.document.execCommand ("SaveAs"), 500); } And {somehtml = document.createElement ("a"); Somehtml.href = canvas.toDataURL ("image / png"); Somehtml.download = "test.png"; }  

This is what I am using - not sure that IE Which version of this is necessary for this I am using 11. It uses a block for IE and canvas as the data URL for other browsers. Tested in Chrome and IE11.

(Canvas canvas object is a link hyperlink object)

  if (canvas.msToBlob) {// for IE var blob = Canvas.msToBlob (); Window.navigator.msSaveBlob (Blob, 'dicomimage.png'); } Else {// Other browsers link.href = canvas.toDataURL (); Link.download = "dicomimage.png"; }  

Comments