1

I'm using the svgcanvas.js to create SVG and trying to save the svgcode.

With the normal canvas content, I could save the resulting png as below: toDataURL and with window.location.href the save as Dialog appeared in my Browser.

With the SVG, the SVG appears in the URL. How can I make the Browser save the SVG-Code as File?

var ctx = new CanvasSVG( "#SVG" );
ctx.beginPath();
ctx.fillStyle = "#333333";
ctx.fillRect( 10 , 10 , 50 , 50 );
ctx.closePath();

document.getElementById( "xml" ).innerHTML = ctx.toDataURL( "image/svg+xml" );
var image=ctx.toDataURL( "image/svg+xml" );
window.location.href=image;
mikolaskova
  • 121
  • 6
  • Possible duplicate of [How to save svg canvas to local filesystem](http://stackoverflow.com/questions/2483919/how-to-save-svg-canvas-to-local-filesystem) – Cees Timmerman Oct 02 '15 at 13:44

0 Answers0