frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

HTML-only conditional lazy loading (via preload and media)

https://orga.cat/blog/html-conditional-lazy-loading/
71•netol•8h ago

Comments

DamonHD•8h ago
Nice pure-declarative responsive tweak!
simonw•4h ago
> The accepted practice is to not add lazy-loading to images above the fold, especially the LCP image.

I didn't know that. Apparently (at least according to Claude) you shouldn't use loading="lazy" on images that you expect to always display because doing so causes them to not be loaded until the browser has determined they are definitely in the viewport, which is a minor performance regression.

LCP = Largest Contentful Paint, the Core Web Vitals metric for when the largest visual element finishes rendering. That's usually the largest above-the-fold image.

alexandermorgan•4h ago
Yes but the post is explicitly about images that are initially loaded only on certain devices/screen sizes, hence the need for conditional application of lazy loading.
bmacho•4h ago
> Not documented anywhere (but seems to work fine in major browsers)

Which part of it is not documented? Putting device width dependent preloading in HTTP header? MDN says that the HTTP link header works the same way as the link element, and also that the link element a has media attribute : https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

netol•4h ago
I could not find this hack documented or discussed anywhere, that's what I meant.
lightningspirit•4h ago
I like this solution, it looks very simple and should’ve been consider as part of best practices if it works technically. However, I also think that this whole trade off is broken from the beginning, it should be part of browser’s set of rules to either decide or not it should render the image or not by default, and the decision of eagerly load an image should just an hint given by the developer as a scape hatch. The current approach forces the decision to be forcefully deferred to the application which needs to guess what’s the best approach for the current set of devices in the market which also adds a constant maintenance burden.
DamonHD•2h ago
Browsers already have an early scanner to look ahead for things that it may need to load soon, such as images, and piles of heuristics. Those heuristics are hard in part because many HTML authors don't bother marking up their image dimensions. The lazy attribute helps avoid loading images that the author can be fairly sure will not be in the initial viewport, so is an optimisation hint to override some of those heuristics. So it saves some bandwidth and helps ensure that things above the fold are not fighting things below in the initial viewport construction. So we're about two levels of optimisation in here, but browsers do a reasonable job when fed good img tags anyway.
onionisafruit•3h ago
Is it the “min-width=1024px” in the link that causes it to not load on smaller devices?
netol•3h ago
To not preload, yes
xnx•38m ago
Not a fan of lazy loading. My time is more valuable than bandwidth.
abejfehr•16m ago
Isn’t that why you should like it then? It saves your time because you’d get the page earlier

Open-source iCloud Photos Downloader (AKA escape from iCloud)

https://github.com/icloud-photos-downloader/icloud_photos_downloader
19•reconnecting•36m ago•5 comments

Meta announces nuclear energy projects

https://about.fb.com/news/2026/01/meta-nuclear-energy-projects-power-american-ai-leadership/
121•ChrisArchitect•1h ago•121 comments

Gentoo Linux 2025 Review

https://www.gentoo.org/news/2026/01/05/new-year.html
243•akhuettel•8h ago•118 comments

A set of Idiomatic prod-grade katas for experienced devs transitioning to Go

https://github.com/MedUnes/go-kata
39•medunes•4d ago•6 comments

Poison Fountain

https://rnsaffn.com/poison3/
128•atomic128•2h ago•86 comments

Ask HN: What are you working on? (January 2026)

65•david927•3h ago•254 comments

Anthropic: Developing a Claude Code competitor using Claude Code is banned

https://twitter.com/SIGKITTEN/status/2009697031422652461
50•behnamoh•53m ago•20 comments

Perfectly Replicating Coca Cola [video]

https://www.youtube.com/watch?v=TDkH3EbWTYc
46•HansVanEijsden•3d ago•14 comments

"Food JPEGs" in Super Smash Bros. & Kirby Air Riders

https://sethmlarson.dev/food-jpegs-in-super-smash-bros-and-kirby-air-riders
222•SethMLarson•5d ago•53 comments

Happy 50th Birthday KIM-1

https://github.com/netzherpes/KIM1-Demo
54•JKCalhoun•6h ago•17 comments

"Scholars Will Call It Nonsense" the Structure of Erich von Däniken's Argument

https://www.penn.museum/sites/expedition/scholars-will-call-it-nonsense/
5•Kaibeezy•34m ago•0 comments

I dumped Windows 11 for Linux, and you should too

https://www.notebookcheck.net/I-dumped-Windows-11-for-Linux-and-you-should-too.1190961.0.html
567•smurda•8h ago•574 comments

C++ std::move doesn't move anything: A deep dive into Value Categories

https://0xghost.dev/blog/std-move-deep-dive/
206•signa11•2d ago•156 comments

BasiliskII Macintosh 68k Emulator Ported to ESP32-P4 / M5Stack Tab5

https://github.com/amcchord/M5Tab-Macintosh
67•rcarmo•7h ago•9 comments

Show HN: Epstein IM – Talk to Epstein clone in iMessage

https://epstein.im/
5•RyanZhuuuu•19h ago•7 comments

Pigeon's Device (2009)

http://pigeonsnest.co.uk/stuff/pigeons-device.html
3•gaul•1h ago•0 comments

Instagram data breach reportedly exposed the personal info of 17.5M users

https://www.engadget.com/cybersecurity/an-instagram-data-breach-reportedly-exposed-the-personal-i...
158•IvanAchlaqullah•4h ago•52 comments

The Concise TypeScript Book

https://github.com/gibbok/typescript-book
195•javatuts•14h ago•43 comments

China applies to put 200K satellites in space after calling Starlink crash risk

https://www.scmp.com/news/china/science/article/3339493/china-applies-put-200000-satellites-space...
25•nkurz•5h ago•7 comments

My Home Fibre Network Disintegrated

https://alienchow.dev/post/fibre_disintegration/
228•alienchow•15h ago•198 comments

You are not required to close your <p>, <li>, <img>, or <br> tags in HTML

https://blog.novalistic.com/archives/2017/08/optional-end-tags-in-html/
125•jen729w•1d ago•191 comments

HTML-only conditional lazy loading (via preload and media)

https://orga.cat/blog/html-conditional-lazy-loading/
72•netol•8h ago•11 comments

KaraDAV – Lightweight Nextcloud compatible WebDAV server

https://github.com/kd2org/karadav
30•indigodaddy•7h ago•1 comments

Vojtux – Unofficial Linux Distribution Aimed at Visually Impaired Users

https://github.com/vojtapolasek/vojtux
107•TheWiggles•4d ago•26 comments

Finding and fixing Ghostty's largest memory leak

https://mitchellh.com/writing/ghostty-memory-leak-fix
583•thorel•1d ago•122 comments

Are We ... Yet?

https://wiki.mozilla.org/Areweyet
20•mooreds•1h ago•6 comments

Show HN: I used Claude Code to discover connections between 100 books

https://trails.pieterma.es/
459•pmaze•1d ago•137 comments

More than one hundred years of Film Sizes

https://wichm.home.xs4all.nl/filmsize.html
80•exvi•11h ago•18 comments

Code and Let Live

https://fly.io/blog/code-and-let-live/
422•usrme•2d ago•166 comments

CPU Counters on Apple Silicon: article + tool

https://blog.bugsiki.dev/posts/apple-pmu/
153•verte_zerg•4d ago•1 comments