How to capture full-page screenshots of lazy-loaded content
Modern websites often use lazy loading for images and content. Learn how to capture complete screenshots with all content properly loaded.
Lazy loading is everywhere. It improves page performance by deferring the loading of images and content until they're needed. But it creates a challenge for screenshot APIs: how do you capture a full-page screenshot when half the content hasn't loaded yet?
The problem
When you request a full-page screenshot of a lazy-loaded page, you might get something like this:
- Images below the fold appear as blank placeholders
- Infinite scroll content is missing entirely
- Dynamically loaded sections show loading spinners
The solution: scroll_into_view
LambdaShot's full_page option automatically handles lazy loading by scrolling through the entire page before capturing. This triggers lazy-loaded content to appear.
GET /take?url=https://example.com&full_page=true Behind the scenes, we:
- Calculate the full page height
- Scroll incrementally through the page
- Wait for images and content to load at each scroll position
- Scroll back to the top
- Capture the complete screenshot
Fine-tuning with delays
Some pages have particularly slow-loading content. You can add a delay to ensure everything loads:
GET /take?url=https://example.com&full_page=true&delay=3
The delay parameter (in seconds) adds wait time after the page loads but before scrolling begins.
Handling infinite scroll
Infinite scroll pages present a unique challenge - they never truly end. For these, you have two options:
- Set a viewport height - Capture only what fits in a specific viewport
- Use scroll_count - Limit how many scroll iterations to perform
GET /take?url=https://example.com&full_page=true&scroll_count=5 Best practices
- Start with
full_page=trueand no delay - Add
delayonly if content is missing - Use
scroll_countfor infinite scroll pages - Consider
block_ads=trueto speed up loading
For more details, check out our full API reference.