0

I’ve been looking for the solution to convert or extract the svg from a url link svg file to html as original from the link.

e.g.

https://server/soccerball.svg (image url from server that has svg components inside with its paths etc.)

I would like to get the element from inside the link following with its paths and attributes on every elements from the link above in JavaScript. It can be in a form of actual element/string it wont matter.

For example from the link above converted to:

<svg attr…>…

Thanks in advance!

  • Add an `` element with `src="https://server/soccerball.svg"` attribute? – Alon Eitan Nov 04 '21 at 03:18
  • Use `fetch` as indicated on [this answer](https://stackoverflow.com/a/67611415/3695983). That way you'll read the SVG as a string and you can put it on the page or process it however you want. – Alvaro Montoro Nov 04 '21 at 03:52
  • Better answer using ``fetch``: https://stackoverflow.com/questions/69801088/load-an-svg-image-where-the-elements-become-part-of-the-dom – Danny '365CSI' Engelman Nov 04 '21 at 09:44

0 Answers0