Skip to content

Instantly share code, notes, and snippets.

@barning
Created March 3, 2015 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barning/74c01247f9bd287f3139 to your computer and use it in GitHub Desktop.
Save barning/74c01247f9bd287f3139 to your computer and use it in GitHub Desktop.
var downloadAsSVG = function (fileName) {
if(!fileName) {
fileName = "dieflaeche"+second()+minute()+day()+year()+".svg"
}
var url = "data:image/svg+xml;charset=utf-8,"+encodeURIComponent(mySVG);
var link = document.getElementById("download");
link.download = fileName;
link.href = url;
link.click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment