Lazy ładowanie

How lazy ładowanie images i iframes poprawia Core Web Vitals, the ładowanie atrybut, the SEO risks of lazy-ładowanie above-the-fold treść, i how Googlebot renders deferred treść.

Opublikowano po raz pierwszy: 2 lip 2026 · Ostatnia aktualizacja: 3 sie 2026 · Advanced
Języki

Lazy ładowanie defers off-screen images i iframes until they're o to scroll do view, cutting initial strona weight i helping Core Web Vitals. The native way jest the ładowanie="lazy" atrybut on <img> i <iframe> — no JavaScript needed. The big mistake jest lazy-ładowanie twój hero/LCP image, który opóźnienia Largest Contentful Paint. Googlebot doesn't scroll lub click, so anything gated behind a scroll lub click event może go unseen. It's nie a bezpośredni czynnik rankingowy — the effect runs przez Core Web Vitals i możliwość indeksowania. Verify co actually renders in Search Console's URL Inspection narzędzie: the image URLs powinien sit in the src atrybut of the wyrenderowany HTML.

TL;DR — Lazy ładowanie defers off-screen images i iframes until they near the viewport, cutting initial strona weight (pomaga LCP) i startup main-thread działać (pomaga INP). The native loading="lazy" atrybut on <img>/<iframe> ma replaced najbardziej JS libraries; tylko lazy i eager są meaningful wartości (auto jest deprecated). The damaging mistakes: lazy-ładowanie the LCP/above-the-fold image (opóźnienia the bardzo metric you’re chasing), i gating treść behind scroll/click — który Googlebot nigdy triggers ponieważ it doesn’t interact z the strona. It’s nie a bezpośredni czynnik rankingowy; the effect runs przez Core Web Vitals i możliwość indeksowania. Verify in Search Console’s URL Inspection narzędzie że image URLs land in the src atrybut of the wyrenderowany HTML.

co lazy ładowanie actually robi

The idea jest prosty: tylko load zasoby gdy you need them, zamiast ładowanie everything at once. On a media-heavy strona, downloading każdy image i embed up front zachowuje the przeglądarka busy pobieranie things the visitor może nigdy scroll to — burning przepustowość, memory, i battery dla nothing. Deferring the off-screen ones lets the above-the-fold treść paint sooner. Martin Splitt made exactly ten point on Google’s Search Off the Record episode “Lazy loading demystified”: the goal jest to avoid działać że yields nothing, ponieważ non-critical images the strona by być fine bez just zachowaj przeglądarka occupied.

ten connects to the Core Web Vitals najbardziej people są chasing. Fewer bytes competing dla the network up front means the Largest Contentful Paint element może render sooner. dla iframes — ads, social widgets, comment sekcje, maps — deferring them również cuts main-thread działać podczas startup, który jest an Interaction to następny Paint win, nie just an LCP one. Google’s own web.dev guidance frames lazy-załadowany iframes as an INP improvement podczas strona load.

Native vs. JavaScript-driven lazy ładowanie

A kilka years ago, przeglądarki gained a native loading atrybut dla images i iframes, so you może hand the whole job to the przeglądarka zamiast wiring up a JavaScript API. In my SEO JavaScript poradnik at Ahrefs I make the same observation: since I pierwszy wrote że piece, lazy ładowanie ma mostly moved z będąc JavaScript-driven to będąc handled by przeglądarki. You’ll nadal run do JS-driven setups, i dla images they’re zwykle fine — the thing I sprawdzenie jest whether rzeczywisty treść (nie just images) jest będąc lazy załadowany, ponieważ tamte setups są the ones że mieć caused treść nie to być picked up correctly.

The native version:

<!-- Below-the-fold image: defer it -->
<img src="gallery-07.jpg" loading="lazy" width="800" height="600" alt="…">

<!-- Off-screen embed: defer it -->
<iframe src="https://www.youtube.com/embed/…" loading="lazy" title="…"></iframe>

zawsze ustawić explicit width/height (lub an aspect-ratio) on lazy images so the przeglądarka reserves the space przed the image loads — że’s the biggest layout-shift risk z deferred images. Reserved dimensions aren’t an absolute CLS guarantee, though: if the surrounding layout lub a responsive crop nadal changes po the image loads, you może nadal see a shift, so confirm z a rzeczywisty layout-shift trace zamiast assuming fixed dimensions alone settle it.

Lazy ładowanie i iframes need one więcej distinction: loading="lazy" on an <iframe> tylko defers gdy the embed’s fetch i creation happen. It doesn’t ustawić jego title, focus behavior, sandbox, allow/permissions polityka, referrerpolicy, zgoda handling, lub dimensions dla you — tamte nadal need ich own attention, i an embed może zachować doing działać (scripts, tracking pixels, layout) once it becomes eligible to load. i don’t assume “below the fold” behaves the same everywhere: display: none treść, offscreen carousel slides, transformed elementy, i nested scroll containers może intersect the viewport differently than a plain below-the-fold element, so test the rzeczywisty layout i navigation controls zamiast assuming equivalence.

The loading atrybut’s wartości

tylko two wartości matter today:

  • loading="lazy" — defer the zasób until it’s near the viewport.
  • loading="eager" — load it immediately, the domyślny behavior. używać it to być explicit o above-the-fold images.
Evidence for this claim The native loading attribute supports lazy loading for images and iframes without a JavaScript lazy-loading library. Scope: Browser-level lazy loading behavior; browser heuristics decide the fetch distance. Confidence: high · Verified: web.dev: Browser-level image lazy loading

You może see loading="auto" in older artykuły — it’s deprecated in Chrome, so don’t reach dla it. There’s no need to; omitting the atrybut już gives you the domyślny (eager) behavior.

How near jest “near”? loading="lazy" jest a hint, nie an author-controlled guarantee — the spec leaves the rzeczywisty near-viewport decision to the przeglądarka. Chromium tries to fetch a lazy zasób early enough że it’s ready by the time you scroll to it, i the trigger distance varies by przeglądarka, connection speed, i zasób type; it isn’t a fixed pixel wartość you może rely on lub reproduce w całym przeglądarki lub versions. Don’t publikować — lub trust — a specific “loads N pixels before the viewport” liczba; treat the near-viewport window as implementacja-defined i confirm rzeczywisty behavior z a Network trace on the przeglądarka/connection you care o zamiast assuming a constant.

Native lazy ładowanie również plays fine z responsive images: it applies to ordinary src i srcset/sizes selection, so you don’t lose responsive image behavior by adding loading="lazy". If you instead hide the rzeczywisty URL tylko in a data-* atrybut dla a script to swap in later, ładowanie now depends on że script — test the wyrenderowany HTML i co happens if the script fails (więcej on ten in the Scripts i Troubleshooting tabs).

Evidence for this claim Native lazy loading works with ordinary src and responsive srcset/sizes selection; hiding the real URL only in data-* attributes makes loading dependent on script and should be tested in rendered HTML and under script failure. Scope: responsive image fetching and layout Confidence: high · Verified: HTML Standard: img

The #1 mistake: lazy-ładowanie the LCP / above-the-fold image

ten jest the awaria I see najbardziej, i każdy źródło agrees on it. If you lazy-load the hero image — lub dowolny image prawdopodobny to być the LCP element — you’ve told the przeglądarka to wait on the single najbardziej ważny pixel dla perceived load speed. The przeglądarka również może’t lazy-load an image until it knows gdzie the image będzie sit on the strona, so lazy above-the-fold images tend to load więcej slowly than eager ones. że directly opóźnienia Largest Contentful Paint, the metric Google says powinien resolve w the pierwszy 2,5 seconds of load.

Do not lazy-load the observed or likely LCP image; confirm the actual request and paint timing in a trace. Źródło: Lazy Loading

The eager path discovers the likely LCP image in HTML and starts its request promptly. The lazy path waits for browser loading heuristics before request start. The comparison uses no fixed timing values and notes that actual LCP must be measured.

© Patrick Stox LLC · CC BY 4.0 ·

Splitt put the flip side plainly on the SOTR episode: if you’re nie używając lazy ładowanie gdzie you powinien, że będzie probably hurt niektóre aspect of Core Web Vitals — najbardziej prawdopodobny LCP. So it cuts oba ways. The reguła:

  • Probable lub observed LCP candidate → load eagerly (omit loading="lazy", lub ustawić eager). Consider fetchpriority="high" on the LCP image.
  • Below the fold → loading="lazy".

nie każdy image above the fold jest the LCP candidate — zidentyfikuj rzeczywisty one (a wydajność trace lub PageSpeed Insights będzie nazwa it) i verify jego żądanie timing zamiast treating każdy pierwszy-screen image the same. i te są oddzielny hints, nie one setting: loading="eager" (lub omitting loading) tylko means the przeglądarka won’t defer discovery of the zasób — it doesn’t itself raise fetch priority. fetchpriority jest a distinct, advisory hint on top of że. Stacking a <link rel="preload"> with ładowanie="lazy" on the same zasób wysyła the przeglądarka conflicting intent, so sprawdź rzeczywisty network waterfall zamiast assuming the combination robi co you expect.

The blanket anti-pattern jest switching on lazy ładowanie dla każdy image witryna-wide — a common CMS domyślny. As Splitt noted, if każdy image jest lazy załadowany, then images że są (lub powinien być) immediately visible get lazy załadowany too, który jest exactly the case you want to avoid.

How Googlebot renders lazy-załadowany treść

Here’s the crawling reality że trips people up: Googlebot doesn’t scroll, i it doesn’t click. It renders twój strona z a headless przeglądarka, ale it doesn’t simulate a użytkownik interacting z it. Google states ten directly — jego recommended lazy-ładowanie metody deliberately don’t rely on użytkownik actions like scrolling lub clicking, ponieważ Google Search robi nie interact z twój strona.

Evidence for this claim Google Search does not scroll or click to trigger lazy-loaded content, so implementations should not depend on user interaction and should expose resource URLs in rendered HTML. Scope: Google Search guidance for JavaScript-driven lazy loading. Confidence: high · Verified: Google Search Central: Lazy-load content

że’s why the how of twój implementacja matters. Google’s doc listy three implementacje it considers bezpieczny: the przeglądarka’s built-in lazy ładowanie dla images i iframes, the IntersectionObserver API (z a polyfill), lub a JavaScript library że loads data as it enters the viewport. wszystkie three key off viewport intersection — nie a scroll lub click event że Googlebot będzie nigdy fire.

The wysoki-risk pattern jest a custom lub third-party JS lazy-load library. If the library misbehaves i the image URL nigdy lands in the src atrybut, Google simply won’t pick że image up — Splitt described exactly ten awaria mode on the SOTR episode. There’s nothing to index if the URL isn’t there. ten jest the same thing I flag in my SEO JavaScript poradnik: image lazy ładowanie jest zwykle fine, ale lazy-załadowany treść jest gdzie indeksowanie problems creep in, i the fix jest to sprawdzenie co Google actually renders.

Infinite scroll jest a różny problem

Don’t conflate basic image/iframe lazy ładowanie z infinite scroll lub paginated ładowanie. Deferring images jest one thing; ładowanie new chunks of treść as the użytkownik scrolls jest another, i it needs jego own architektura. Google’s guidance: give każdy chunk a persistent, unique URL, zachowaj treść stable per URL (używać absolute strona liczby like ?page=12, nie relative wartości like ?date=yesterday), i update the displayed URL z the History API as każdy chunk becomes the primary visible treść so it może być refreshed, shared, i linked. Skip że i the deeper treść behind an endless scroll może nigdy być reliably crawled lub zindeksowany.

How to test it

The verification path jest the same in Google’s doc i in my own methodology: używać Search Console’s URL Inspection narzędzie i look at the wyrenderowany HTML. If twój image (lub video) URLs appear in the src atrybut on the <img>/<video> elementy in że wyrenderowany HTML, twój setup działa. Google says ten outright — sprawdź wyrenderowany HTML to upewnij się twój treść jest in it. If the URL jest missing z src, że’s twój problem, i it zwykle points back to a scroll/click trigger lub a broken library.

dla a lazy-załadowany produkt grid, go beyond ten presence sprawdzenie. Run the Infinite Scroll SEO testing matrix z standard i tall viewports, fresh navigation i post-load resizing, no-action i incremental-scroll runs, unique produkt-link counts, i accessibility-tree inspection. Resizing an initialized strona jest nie equivalent to navigating at the final viewport size ponieważ observers i batch calculations może być registered tylko podczas startup. Evidence for this claim Google Search does not scroll or click to trigger lazy-loaded content, so implementations should not depend on user interaction and should expose resource URLs in rendered HTML. Scope: Google Search guidance for JavaScript-driven lazy loading. Confidence: high · Verified: Google Search Central: Lazy-load content

You może również lean on twój web-wydajność tooling: PageSpeed Insights flags off-screen images you powinien być deferring. In my PageSpeed Insights poradnik at Ahrefs I note że the “defer offscreen elements” audit jest telling you to lazy-load images — a handy way to connect the diagnostic you już run to the fix.

Ranking-signal honesty

być jasny o co lazy ładowanie jest i isn’t. używając it jest nie a bezpośredni ranking factor, i nie używając it isn’t a penalty. The connection to rankings jest indirect: it flows przez Core Web Vitals (mainly LCP, czasami INP dla iframes) i przez możliwość indeksowania, if a bad implementacja hides treść. Splitt characterized the ranking effect przez Core Web Vitals as a tiny, minute factor in najbardziej cases. So optimize lazy ładowanie dla twój użytkownicy’ load experience i dla clean indeksowanie — nie ponieważ you expect a ranking bump z the atrybut itself.

gdzie ten fits

Lazy ładowanie jest one lever in the broader web wydajność toolkit. It pairs z zasób hints (preload/preconnect dla the zasoby you robić want early), font-ładowanie strategy, buforowanie, i a CDN — i it’s judged, ultimately, przez Core Web Vitals. Get the above-the-fold/below-the-fold split right i it’s one of the cheapest wins available.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.