The Web page With No Code – Dan Q
It began once I noticed no-ht.ml, Terence Eden‘s hilarious response to Salma Alam-Naylor‘s glorious HTML is all you need to make a website. The latter is an argument towards each the foolish quantity of JavaScript with which web sites routinely burden their customers, but in addition even towards relying on CSS. As a fan of CSS Naked Day and a agency believer in utilizing JS just for progressive enhancement, I’m clearly in favour.
Terence’s web site works by delivering a doc with a claimed MIME sort of textual content/html
, however which comprises solely the (invalid) “HTML” code <!doctype UNICODE><meta charset="UTF-8"><plaintext>
(to work round browsers’ want to deal with the web page as HTML). That is adopted by a block of UTF-8 plain textual content making use of spacing and emoji for instance and embellish the content material. It’s frankly very foolish, and I find it irresistible.
I feel it’s attainable to go one step additional, although, and create an internet web page with no code by any means. That’s, one that you would be able to learn as if it have been a daily internet web page, however the place utilizing View Supply or e.g. downloading the web page with curl
will present you… nothing.
I current: The Page With No Code! (It’ll in all probability solely work should you’re utilizing Firefox, for causes that may turn into obvious later.)
When you’ve had a search for your self and had an opportunity to kind an opinion, right here’s an evidence the black magic that makes this atrocity attainable:
- The web page is clean. It’s delivered with
Content material-Sort: textual content/html
. Your browser interprets a completely-blank web page as defective and corrects it to a functionally-blank minimal HTML web page:<html><head></head><physique></physique></html>
. <physique>
and<html>
parts will be styled with CSS; this contains the power so as to add content:::earlier than
and::after
every component. If solely we might load a stylesheet then content material injection is feasible.- We use the fourth way to inject CSS – a
Hyperlink:
HTTP header – to ship a CSS payload (this, sadly, solely works in Firefox). To additional obfuscate what’s occurring and take away the necessity for a round-trip, that is encoded as an information: URI.
This is likely one of the most disgusting issues I’ve ever coded, and that’s saying quite a bit. I’m so happy with myself. You may view the code I used to generate this awful thing on Github.