Use GrabzIt’s JavaScript API to capture a URL, supplied HTML, or the visitor’s current page with ConvertURL, ConvertHTML, or ConvertPage. Include the JavaScript library, use your application key, authorize the site’s domain, and choose how to display or retrieve the result. The API completes captures asynchronously; its onfinish callback supplies a capture ID that you can pass to a protected server endpoint when you need to save the file.
What you need before writing the capture code
- A GrabzIt application key and the JavaScript library included on the page.
- The domain where the JavaScript will run must be authorized for that key. GrabzIt warns that the JavaScript API will not work until an allowed domain is configured. See GrabzIt’s setup documentation for the current setup path.
- A decision about the source: a URL, HTML markup, or the current page.
- A result-handling plan: display the capture in the page, keep it hidden, pass a data URL to code, or retrieve it on your server.
The documentation’s JavaScript examples use a CDN-hosted library. Check GrabzIt’s current JavaScript setup instructions for the exact library URL and key handling before deploying; the available material does not establish a library release version.
Choose what to capture
Capture a URL
Use ConvertURL(url, options) when the source is a web page address. The page is rendered by GrabzIt, so this is distinct from taking a picture of the browser tab currently open to your own site.
Capture supplied HTML
Use ConvertHTML(html, options) when your application already has markup to convert. Set options as needed for the desired output and dimensions.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute#1 Best Overall
Capture the current page
Use ConvertPage(options) when the source should be the visitor’s current page. This is useful for a user-triggered capture of the rendered page, but it still depends on the JavaScript integration and authorized domain.
Load the library and start a capture
Use the current CDN script URL and invocation pattern shown in GrabzIt’s official JavaScript setup guide. The examples below show the API calls and result handling; replace the illustrative library include with the exact current URL from that guide.
Rank #2
<script src="CURRENT_GRABZIT_LIBRARY_URL"></script>
<script>
const grabzIt = new GrabzIt("YOUR_APPLICATION_KEY");
grabzIt.ConvertURL("https://example.com", {
format: "png",
bwidth: 1280,
bheight: 800,
delay: 1000,
onfinish: function (captureId) {
console.log("Capture ready:", captureId);
},
onerror: function (error) {
console.error("Capture failed:", error);
}
});
</script>
This is an illustrative pattern, not a guarantee that every option or callback spelling is available for every account package or output type. Confirm the current method signatures and parameter names in the GrabzIt parameter reference and event documentation before relying on them in production. The JavaScript API accepts an options object; you can omit it when defaults are suitable.
Choose how the result is handled
GrabzIt documents several ways to use a completed capture, depending on whether you want to show it to the visitor or pass it to other code.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →| Method | What it does | Use it when |
|---|---|---|
Create() |
Inserts the capture at the beginning of the document body, or the document root if there is no body. | You want GrabzIt to add the result to the page without selecting a destination element. |
AddTo(elementOrId) |
Places the result in a chosen DOM element or element ID. | You want the capture displayed in a specific part of your page. |
CreateInvisible() |
Creates the capture without displaying it on the page. | You need a capture for subsequent processing rather than direct display. |
DataURI(callback, decrypt) |
Passes a base64 data URL to a callback; the optional decrypt argument is for encrypted captures. | Your client-side code needs the capture as a data URL. |
Check the current JavaScript API reference for the exact invocation syntax for these methods and any output-specific requirements.
Set output, viewport, and timing options
Capture settings are optional parameters. The current parameter reference describes supported formats, dimensions, timing controls, and other options. Defaults and limits can vary by output type or account package, so treat the live reference as authoritative for your configuration.
Rank #4
Format and dimensions
formatselects an output format. The reference includes JPG, PNG, PDF, and other capture or export types; available choices depend on the task.bwidthandbheightset browser dimensions used to render the page.widthandheightset output image dimensions. They are not substitutes for the browser viewport settings.- A full-length option can request a whole-page capture where supported. Check the parameter reference for its name and compatibility with the selected output.
Wait for the page to be ready
delaywaits a fixed period before capture. The parameter reference lists a maximum of 30,000 milliseconds; verify the live limit for your configuration.waitforwaits for a matching visible element rather than relying only on a fixed delay. The reference lists a maximum wait of 25 seconds.
A fixed delay is simple but may waste time on fast pages or be too short for slow ones. A selector wait can better match a page-specific readiness condition, but it requires a reliable visible element. Neither option guarantees that every late-loading asset or third-party widget has finished rendering.
Use callbacks for completion and errors
Captures are asynchronous. The event documentation describes onstart, onfinish, and error handling. The finished callback receives a capture ID when the screenshot is ready; use the error callback to handle failures rather than treating a missing result as success. Confirm the live callback signatures and error details in GrabzIt’s event reference.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Best Value
Keep UI state explicit: show a pending state when you start the capture, update it only after successful completion, and show a useful failure message if capture generation or retrieval fails. Do not assume starting a conversion means the output is already available.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Save a completed capture on your server
When the browser receives the capture ID in onfinish, it can send that ID to an application endpoint you control. Your server can then call GrabzIt’s server-side API—for example, its PHP GetResult flow—to retrieve the capture bytes and write them to storage. See the GrabzIt support guidance on retrieving results for the documented pattern.
- In the browser’s
onfinishcallback, send the capture ID to your own endpoint over HTTPS. - On the server, authenticate the caller, validate the capture ID and expected request shape, and apply your application’s authorization rules.
- Use your server-side GrabzIt integration to retrieve the result, then save it using a server-generated filename and an appropriate storage policy.
- Return only the status or safe file reference the browser needs.
The support example demonstrates the retrieval pattern; it is not a complete security design. Do not put application secrets or storage credentials in browser JavaScript. If exporting to external storage, GrabzIt’s support guidance recommends selecting its Secure Export URL option so storage credentials are not exposed in client code.
Common problems and practical fixes
| Symptom | Likely cause | What to check |
|---|---|---|
| The JavaScript API does not work on your site. | The site’s domain has not been authorized for the application key. | Configure the allowed domain for that key in GrabzIt, then retry from the authorized origin. |
| The capture is ready but does not appear where expected. | The result method is inserting elsewhere, or the selected target element is missing. | Use AddTo with the intended element or ID, or choose Create if document insertion is acceptable. |
| The capture misses content that appears later. | The capture began before the target page finished rendering the relevant content. | Use an appropriate delay or wait for a visible selector with waitfor; check the current documented limits. |
| The output has unexpected dimensions. | Browser viewport dimensions and output image dimensions were confused. | Set bwidth/bheight for rendering and width/height for output sizing. |
| Server saving exposes a key or storage credential. | A secret was placed in client-side code. | Move retrieval and persistence to a protected server endpoint; use GrabzIt’s Secure Export URL option for storage export. |
| An option is rejected or behaves differently from expected. | The option’s default, maximum, output compatibility, or package entitlement differs. | Check the current parameter reference for the selected output and account package instead of assuming a universal limit. |
Or skip the browser setup
ScreenshotNeo is a screenshot API with one GET request for a URL. It accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. It also offers an MCP server for AI agents using Claude, Cursor, or other MCP clients.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for options and setup. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




