JavaScript Rendering
Web Scraping API JavaScript Rendering
What is JavaScript Rendering
JavaScript rendering is the process of executing JavaScript on a webpage to generate dynamic content. Dynamic content refers to data or elements that are loaded or updated on the webpage after the initial HTML is delivered. Many modern websites rely on JavaScript to load data and modify their layout in real time.
Not Using VS Using JavaScript Rendering
Not using JavaScript rendering:
- Retrieves only the initial
HTML
. - Fast and resource-efficient, but misses dynamic content.
Using JavaScript rendering:
- Executes JavaScript to load full content, including dynamic data.
- Slower and resource-intensive, but essential for modern dynamic sites.
When to Use JavaScript Rendering
- Static Websites: No JS rendering needed.
- Dynamic Websites: Use JS rendering to capture complete content.
- Interactive Elements: Necessary for scraping data behind user interactions. For example, browser actions.
How to Use JavaScript Rendering in Your Requests
To include rendering to your request, you will need to add the headless
parameter with either html
or png
set as the value.
curl --request 'POST' \
--url 'https://scraper-api.decodo.com/v2/scrape' \
--header 'Accept: application/json' \
--header 'Authorization: Basic <token>' \
--header 'Content-Type: application/json' \
--data '
{
"target": "universal",
"url": "https://ip.decodo.com/ip",
"headless": "html"
}
'
Advanced vs Core API Subscriptions
Scraping API Core subscriptions are not able to use the JavaScript rendering parameter, only Advanced subscriptions are eligible.
Google and JavaScript Rendering
Google targets require JS rendering, and are only reachable with our Advanced scraping API subscriptions.
Support
Still can't find an answer? Want to say hi? We take pride in our 24/7 customer support. Alternatively, you can reach us via our support email at [email protected].
Updated 1 day ago