To save a SVG when it is rendered in the page, you can write this in the console:

1
2
3
4
5
6
7
8
9
var svgData = $("#figureSvg")[0].outerHTML;
var svgBlob = new Blob([svgData], {type:"image/svg+xml;charset=utf-8"});
var svgUrl = URL.createObjectURL(svgBlob);
var downloadLink = document.createElement("a");
downloadLink.href = svgUrl;
downloadLink.download = "newesttree.svg";
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);

Reference

How do I save/export an SVG file after creating an SVG with D3.js (IE, safari and chrome)?