The button below will write the following SVG image to the page (remember: SVG files are just code):
|
|
Which when loaded will trigger the XSS payload marked above. Any SVG file can contain javascript code, but to execute it you have to be able to access the file directly via either writing it to the page or visiting the SVG file directly. Embedding it in e.g. an img tag will not work.
A SVG file with the code mentioned above is hosted here if you want to see for yourself that it executes the payload: XSS through SVG