Solution

The snippet of code above is pretty simple. We grab the canvas element and execute window.navigator.msSaveBlob(). The first argument expects a blob which is returned from canvas.msToBlob(). The second argument in msSaveBlob() is the filename of the PNG image.

That's it. Attach this code to a click event and on click, a download prompt will fire up to download the PNG.