PDFPageElement: loading property

Works in all major browsers
Since July 2026

WebPDF works in Chrome and Edge 125, Firefox 153 and Safari 18, on desktop and mobile, and in every later version: the oldest versions its PDF.js build supports, which already have every platform feature WebPDF needs. Since July 2026, that is every major browser.

The loading property of the PDFPageElement interface sets or returns when a <pdf-page> draws for the first time, like loading on <img>. It reflects the loading HTML attribute.

Value

A string:

"eager"

Draws as soon as the file has loaded. This is the default, and any value other than lazy is eager.

"lazy"

Sizes the page at once, then draws it when it comes within one viewport of the visible area, or when it is found, focused or printed. In an <iframe>, that is one viewport of the frame, while the frame itself is near the visible area. A lazy canvas=ium page also waits until then to load PDFium.

A lazy page fires load once sized and render once drawn, and matches :state(pending) until then. loading only delays the first render; changes after that draw at once. A file whose pages are all lazy also waits for one of them to come near before it verifies its signatures.

Examples

Lazy pages

Only the pages you scroll to are drawn.

HTML

html
<pdf-file id=f src=//pdf.ist/web.pdf></pdf-file>
<pdf-page of=f no=1 loading=lazy scale=0.3></pdf-page>
<pdf-page of=f no=2 loading=lazy scale=0.3></pdf-page>
<pdf-page of=f no=3 loading=lazy scale=0.3></pdf-page>
<pdf-page of=f no=4 loading=lazy scale=0.3></pdf-page>

Result

Specifications

Not part of any specification. <pdf-file> and <pdf-page> are autonomous custom elements defined by WebPDF.pro.

Browser compatibility

desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
loading
1251251531111812515383182712518

Legend

Full support

See also