Options
script
JavaScript added to the page right before the capture.
- Type
- string
- Default
- None
- Group
- Custom code
On this page
OverviewLink to this section
JavaScript added to the page once it has loaded, been scrolled and been cleaned of banners, right before your styles, the extra wait and the capture. It runs inside the page with full access to the document, so you can close a popup, open a tab, fill in a demo value or remove an element.
The script runs once and is not awaited. If it starts something that takes time, such as a click that loads more content, give it that time with waitBeforeScreenshot.
ExampleLink to this section
The same request with the SDK, with cURL and as the raw JSON body.
screenshot.ts
import { Url2Image } from '@url2image/sdk'
const { success, data, message } = await Url2Image({
url: 'https://example.com',
token: process.env.URL2IMAGE_TOKEN,
options: {
script: 'document.querySelector("#newsletter-popup")?.remove()'
}
})Good to knowLink to this section
Related optionsLink to this section
stylesCSS added to the page right before the capture.bypassCSPIgnore the page Content Security Policy, which some custom scripts and styles need.waitBeforeScreenshotExtra time to wait before the capture, in milliseconds, up to 60000.
Every option, grouped, is in the options overview.
Something unclear or missing on this page?
Tell us