Good day to all users of Hashcode!

Faced such a problem - there is an html page, SVG graphics (XML) is embedded in it, how can I do that when I click on the button "Save SVG file", what is between the <svg> and </svg> tags is saved to somefile file .svg?

    1 answer 1

    Send to the server what is in svg , On jquery , for example, like this:

     $.ajax({url:'save_data_url', data:$('svg').html()}).success(function(data){location=data;}); 


    And the server will return the download link.

    Save to file using only js or html will not work due to security policy.

    • Thank you, and then using the PHP script I save the jQuery sample ($ ('svg'). Html ()) to somefile.svg file in binary mode? - spoilt
    • It is possible and so, but why in the binary then? - Chad