HTML frontend SVG export download with JavaScript -
i'm using highcharts create svg charts. so, chart shown in frontend, svghtml tag.
now want export chart svg file.
my effort
since svg generated purely in frontend, backend knows nothing it. , if want initialize download content, know make http response content.
so can grab svg content string, upload http request, response content was.
i want better
i think there logically no need transfer such way, because frontend knows want.
i turned help: possible initialize download in frontend?
you can generate download links directly using base64 encoded version of svg data.
you need add data:application/octet-stream;base64, in front of base64 encoded data.
here simple fiddle demonstrate;
edit: can specify filename download attribute in anchor tag make things more pretty.
<a download="your_file_name" href='...'>download</a>
Comments
Post a Comment