š URL Weirdness a URL is a place ā and sometimes the place is *inside the URL*
Module 05 taught that a URL locates a resource. These URLs contain their resource, mint themselves at runtime, or launch a game.
1. An image that is its own URL
This invader was never downloaded. Its pixels are base64 in the src attribute ā
the "file" lives inside this HTML document:
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iā¦
2. An entire web page in a link
The href below is a complete HTML document ā doctype, styles, content ā percent-encoded
into a data: URL. No server will be contacted:
Open the page that lives in its own address ā
(Opens in a new tab; check the address bar ā that IS the page.)
3. Minting URLs at runtime: blob:
JavaScript can create brand-new URLs for data it just made. Click, and this page will generate a text file in memory, give it a URL, and offer it for download:
4. A custom protocol that launches WEB WARS
Sites can register as handlers for web+something:// links.
Step 1 asks the browser's permission; step 2 fires the protocol:
Support: Chromium & Firefox. The scheme must start with
web+ ā the platform guards its own protocol namespace.
5. Deep-link to a phrase on any page text fragments
Add #:~:text=⦠to a URL and the browser scrolls to that exact phrase
and highlights it ā on pages that never defined an anchor there. Zero code on
either end:
Jump into Just HTML, straight to a highlighted sentence ā
This is how "copy link to highlight" in your browser's right-click menu works.
6. Bookmarklets: the one honest javascript: URL
Module 05 said never put javascript: in an href ā with one historic exception:
bookmarklets, tiny programs stored as bookmarks that run on whatever page
you're viewing. Drag this button to your bookmarks bar, then click it on any website:
Johnny from HTML Oldskool considers this a restoration, not vandalism. Reload the victim page to undo.