Rendering Javascript
Learn to scrape JavaScript-rendered pages using ScraperAPI in NodeJS. Enable headless browser rendering with render=true for dynamic content, SPAs, and JS-heavy sites.
If you are crawling a page that requires you to render the Javascript on the page to scrape the data you need, then we can fetch these pages using a headless browser.
To render Javascript, simply set render=true and we will use a headless Google Chrome instance to fetch the page. This feature is available on all plans.
Pass the JavaScript rendering parameter within the URL:
API REQUEST
import fetch from 'node-fetch';
fetch('https://api.scraperapi.com/?api_key=APIKEY&url=http://httpbin.org/ip&render=true')
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})PROXY MODE
const axios = require('axios');
axios.get('https://httpbin.org/ip', {
method: 'GET',
proxy: {
host: 'proxy-server.scraperapi.com',
port: 8001,
auth: {
user: 'scraperapi.render=true',
password: 'APIKEY'
},
protocol: 'http'
}
})
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
});SDK Method
Pass the parameter in the headers:
API REQUEST
PROXY MODE
SDK Method
Last updated
Was this helpful?

