2

In HTML, if you want to run a script after the page is loaded, your can set the defer attribute. However, when I try to do this in an SVG document:

<script type="text/javascript" defer="defer" xlink:href="..."></script>

...it does not seem to "defer" as I would expect. I've been putting the script tag at the end of the file as a workaround, but maybe I'm missing something? Is there a different, more standard way to defer scripts in SVG? I just want the whole DOM parsed and ready when my script runs.

marcus erronius
  • 3,613
  • 1
  • 16
  • 32
  • May be because defer attribute doesn't suppose to work for svg tags? Try `$(document).ready()` function with jQuery or do the same with pure javascript – mr.boris Jul 19 '19 at 22:17
  • 2
    put the script at the end of the document. There's no defer in SVG yet. – Robert Longson Jul 20 '19 at 08:02

0 Answers0