chrisdalke 7 hours ago

I got nerd sniped by a tweet talking about JavaScript in SVG, and set out to find out if I could run DOOM inside an image. And it works, with some caveats.

This is technically an SVG that plays DOOM, including audio and interactivity. Pretty cool, although I'm not sure who had the bright idea to allow Javascript in SVG...

The SVG is just using <foreignObject> to create an HMTL namespace, creating a canvas, and then running js-dos / DOSBox in the canvas.

The big caveat, probably a good thing, is that JavaScript in SVG only works if you load the SVG directly and not inside an <img>, since browsers block this as an XSS prevention.

So this is not portable and can't be embedded in a webpage, but I guess was a fun use of a few hours...

8mobile 3 hours ago

one word, exceptional. Kudos for just thinking that. Doom is a classic and deserves this.