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.<p>This is <i>technically</i> 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...<p>The SVG is just using <foreignObject> to create an HMTL namespace, creating a canvas, and then running js-dos / DOSBox in the canvas.<p>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.<p>So this is not portable and can't be embedded in a webpage, but I guess was a fun use of a few hours...
Heh, first the ZMachine runs under a PostScript file with the GhostScript interpreter, now this.<p>But this is a bit of cheating, because it's spawning HTML+JS inside a SVG as a foreign interface in a browser.<p>zmachine.ps has the whole interpreter in the PS file itself, as it's a Turing Complete language.
Yes, you can play Zork on it.
For me, this works on iPhone after tapping the svg and waiting a bit. It runs through a demo in this mode (since there is no mouse or keyboard) and is very impressive! It includes sound as well!