logoalt Hacker News

aziis98last Friday at 7:18 PM2 repliesview on HN

There are many made with eval-unescape-escape that feel a bit like cheating. Still all very impressive


Replies

jsheardlast Friday at 7:22 PM

The compression tricks used in standalone Javascript demos are significantly more cursed. The meta is to concatenate a compressed binary payload and a HTML/JS decompression stub in the same file, abusing the fact that HTML5 parsers are required to be absurdly tolerant of malformed documents. Nowadays it's done using raw DEFLATE and DecompressionStream, but before that was available they would pack the payload into the pixels of a PNG and use Canvas to extract the data.

Try saving this Normal HTML File and open it in a text/hex editor: https://0b5vr.com/domain/domain.html

senfiajlast Friday at 7:26 PM

If it's possible to do with vanilla JS in any environment then it's not cheating.