Join Nostr
2026-04-24 10:00:20 UTC

Web Standards on Nostr: Your options for preloading images with JavaScript. Alex MacArthur compares five ...

Your options for preloading images with JavaScript. Alex MacArthur compares five approaches to preloading images: new Image(), <link rel="preload">, a hidden <div> with a CSS background, the Cache API, and fetch(). Each method has different trade-offs around browser caching, CORS handling, and flexibility. The article breaks down when to use each technique to prevent lag when displaying images that haven’t been loaded yet. #js #performance

https://macarthur.me/posts/preloading-images/