3 ms·
Svg supports the <script> tag. This allows for some very interesting usages. Other examples: https://www.scriptol.fr/xml/code/invaders.svg https://www.scripto
by marcodiego 6y ago
Svg supports the <script> tag. This allows for some very interesting usages.
Other examples:
https://www.scriptol.fr/xml/code/invaders.svg https://www.scriptol.fr/xml/code/invaders.svg
https://www.nayuki.io/res/full-screen-clock-javascript/full-screen-clock-analog-with-seconds.svg https://www.nayuki.io/res/full-screen-clock-javascript/full-...
https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing_SMIL.svg https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing...
- bawolff 6y agoThe last one is using SMIL (declarative animations) not a <script> tag. Wikipedia doesnt let you upload svgs that embed javascript.
- john-doe 6y agoAnother example, a simple calendar: https://shkspr.mobi/blog/2018/02/this-svg-always-shows-todays-date/ https://shkspr.mobi/blog/2018/02/this-svg-always-shows-today...
- upofadown 6y ago>Svg supports the <script> tag. This allows for some very interesting usages. That raises the question of how one disables the <script> tag on one's browser to prevent the most interesting usages.
- jancsika 6y agoIIRC an svg as the src of an img won't run the script. But it used to be that if you chose "View Image" on the SVG, then it would run the script when it opens the svg in its own window. Not sure if that's still true.
- nayuki 6y agoI first saw your comment on this topic a few weeks ago: https://news.ycombinator.com/item?id=26115086 https://news.ycombinator.com/item?id=26115086