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/
66•netol•6h ago

Comments

DamonHD•6h ago
Nice pure-declarative responsive tweak!
simonw•3h 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•2h 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•2h 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•2h ago
I could not find this hack documented or discussed anywhere, that's what I meant.
lightningspirit•2h 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•1h 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•1h ago
Is it the “min-width=1024px” in the link that causes it to not load on smaller devices?
netol•1h ago
To not preload, yes

Microsoft Windows Media Player stops serving up CD album info

https://www.theregister.com/2026/01/09/microsoft_windows_media_player_forgets/
1•A4ET8a8uTh0_v2•35s ago•0 comments

Sergey Brin is joining Larry Page, in reducing ties to CA

https://www.nytimes.com/2026/01/09/technology/google-founders-california-wealth-tax.html
1•vlod•1m ago•0 comments

Cambridge college to target elite private schools for student recruitment

https://uk.news.yahoo.com/cambridge-college-target-elite-private-185806826.html
1•nephihaha•1m ago•0 comments

Claude Code Orchestrator – Parallel AI Development with Multiple Claude Sessions

https://github.com/reshashi/claude-orchestrator
1•shashimudunuri•1m ago•0 comments

Learning to work (very) remotely (2023)

https://borischerny.com/tech/2023/12/10/Working-Remotely.html
1•mooreds•4m ago•0 comments

A16Z: The Power Brokers

https://www.notboring.co/p/a16z-the-power-brokers
1•paulpauper•5m ago•0 comments

A Closer Look at the 2026 U.S. Food Guidelines

https://www.exfatloss.com/p/a-closer-look-at-the-2026-us-food
1•paulpauper•5m ago•0 comments

Social-MCP: new kind of social network

https://social-mcp.org/
1•gwainrib•5m ago•0 comments

Finding and Fixing a 50k Goroutine Leak That Nearly Killed Production

https://skoredin.pro/blog/golang/goroutine-leak-debugging
2•ibobev•7m ago•0 comments

Hexagonal Architecture in Go: Why Your "Clean" Code Is a Mess

https://skoredin.pro/blog/golang/hexagonal-architecture-go
1•ibobev•7m ago•0 comments

Nano Governments

https://shukla.io/blog/2026-01/nano-gov.html
1•BinRoo•8m ago•1 comments

We Default to Addition

https://www.ufried.com/blog/addition_bias/
1•todsacerdoti•8m ago•0 comments

Type-In Rescue: The C64 Autoboot Generator

https://bumbershootsoft.wordpress.com/2026/01/10/type-in-rescue-the-c64-autoboot-generator/
1•ibobev•9m ago•0 comments

DestinationDrivenCompilation

https://tailrecursion.com/~alan/Lisp/DestinationDrivenCompilation.html
1•mpweiher•10m ago•0 comments

Bespoke Software Is the Future

https://fzakaria.com/2026/01/01/bespoke-software-is-the-future
1•mpweiher•11m ago•0 comments

AI-generated police report mistakenly claims officer was transformed into a frog

https://www.fox13now.com/news/local-news/summit-county/how-utah-police-departments-are-using-ai-t...
2•zdragnar•11m ago•1 comments

Python: What's Coming in 2026

https://thenewstack.io/python-whats-coming-in-2026/
1•MilnerRoute•11m ago•0 comments

The Price of Mathematical Scepticism

https://arxiv.org/abs/2107.12925
1•hackandthink•11m ago•0 comments

'F*ck You, Make Me' Without Saying the Words

https://daringfireball.net/2026/01/fuck_you_make_me_without_saying_the_words
1•chmaynard•17m ago•0 comments

In the Path of a Raging Wildfire, a Luthier's Precious Wood

https://www.nytimes.com/2026/01/09/arts/music/eaton-fire-mario-miralles-violin-cello.html
2•bookofjoe•19m ago•1 comments

Ask HN: How are you balancing AI coding tools with junior developers growth?

2•rubslopes•21m ago•1 comments

Why Julia's GPU Accelerated Ode Solvers Are 20x-100x Faster Than Jax and PyTorch

https://www.stochasticlifestyle.com/why-julias-gpu-accelerated-ode-solvers-are-20x-100x-faster-th...
1•leephillips•22m ago•1 comments

Your Feelings Do Not Scale [video]

https://www.youtube.com/watch?v=6Lz8A6R5rbE
1•mooreds•23m ago•0 comments

Claude Code-native marketing consultant

https://github.com/itsbariscan/claude-code-marketing
2•bariscan•23m ago•0 comments

The Path to a New Smartphone Ecosystem

https://www.421.news/gael-duval-nuevo-ecosistema-mobile/
1•maelito•26m ago•0 comments

Artificial intelligence begins prescribing medications in Utah

https://www.politico.com/news/2026/01/06/artificial-intelligence-prescribing-medications-utah-007...
3•randycupertino•27m ago•1 comments

Confucius Code Agent: Scalable Agent Scaffolding for Real-World Codebases

https://arxiv.org/abs/2512.10398
1•erhuve•27m ago•0 comments

The rise and fall of the Sprinkles empire

https://www.latimes.com/business/story/2026-01-11/rise-fall-of-sprinkles-empire-that-made-cupcake...
1•lxm•34m ago•0 comments

Show HN: I built a Chrome DevTools-style panel for Shopify themes

https://github.com/yakohere/shopify-theme-devtools
1•yakohere•34m ago•0 comments

After RAM and SSDs, PSUs and CPU coolers are next in line for price hikes

https://www.notebookcheck.net/After-RAM-and-SSDs-PSUs-and-CPU-coolers-are-next-in-line-for-price-...
3•akyuu•37m ago•0 comments