Skip to content Skip to sidebar Skip to footer

Button For Downloading SVG In JavaScript & HTML?

There's an SVG image that's rendered in the browser. I want a button below to download the SVG. Looks like download with proper mimetype is the way to go. Attempt:
).innerHTML; const blob = new Blob([svg.toString()]); const element = document.createElement("a"); element.download = "w3c.svg"; element.href = window.URL.createObjectURL(blob); element.click(); element.remove(); }

This should do the trick.


Post a Comment for "Button For Downloading SVG In JavaScript & HTML?"