7 ms·
TIL about window.stop() - the key to this entire thing working, it's causes the browser to stop loading any more assets: https://developer.mozilla.org/en-US/doc
by simonw 9mo ago
TIL about window.stop() - the key to this entire thing working, it's causes the browser to stop loading any more assets: https://developer.mozilla.org/en-US/docs/Web/API/Window/stop https://developer.mozilla.org/en-US/docs/Web/API/Window/stop
Apparently every important browser has supported it for well over a decade: https://caniuse.com/mdn-api_window_stop https://caniuse.com/mdn-api_window_stop
Here's a screenshot illustrating how window.stop() is used - https://gist.github.com/simonw/7bf5912f3520a1a9ad294cd747b851d6?permalink_comment_id=5988313#gistcomment-5988313 https://gist.github.com/simonw/7bf5912f3520a1a9ad294cd747b85... - everything after <!-- GWTAR END is tar compressed data.
Posted some more notes on my blog: https://simonwillison.net/2026/Feb/15/gwtar/ https://simonwillison.net/2026/Feb/15/gwtar/
- 8n4vidtmkvmk 9mo agoNeat! I didn't know about this either. Php has a similar feature called __halt_compiler() which I've used for a similar purpose. Or sometimes just to put documentation at the end of a file without needing a comment block.
- moritzwarhier 9mo agoNot the inverse, but for any SPA (not framework or library) developers seeing this, it's probably worth noting that this is not better than using document.write, window.open and simular APIs. But could be very interesting for use cases where the main logic lives on the server and people try to manually implement some download- and/or lazy-loading logic. Still probably bad unless you're explicitly working on init and redirect scripts.
- Lerc 9mo agoI wonder if this is compatible with Claude Artifacts. I made my own bundler skill that lets me publish artifacts https://claude.ai/public/artifacts/a49d53b6-93ee-4891-b5f1-918ab5160da8 https://claude.ai/public/artifacts/a49d53b6-93ee-4891-b5f1-9... that can be decomposed back into the files, but it is just a compressed base64 chunk at the end. I guess the next question will be if it does work in environments that let you share a single file, will they disable this ability once they find out people are using it.
- BobbyTables2 9mo agoSounds delicious for poisoning search engine crawlers and other bots…