I have a web app that is generating inline SVG graphics in the client on the fly based on user interaction. The graphic is defined partly by element attributes and partially by
I think what is generally missing from these explanations on this topic, is the fact that a ".svg" file is actually just the markup in a text file.
So get the svg contents from the dom, then save a text file with ".svg" filename.
var text = $('#svg-container').html();
text = text.slice(text.indexOf("
If for example illustrator is giving you an error like "SVG invalid, validate svg before continuing". Then double check the contents of the downloaded file, and make sure there isn't any unnecessary s or anything, and that text.slice(text.indexOf("
didn't slice off anything important.