October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

GrabzIt API Screenshot Guide for JavaScript

A practical GrabzIt JavaScript guide to URL, HTML, and current-page captures, output handling, timing options, callbacks, and server-side saving.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

<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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Format and dimensions

  • format selects an output format. The reference includes JPG, PNG, PDF, and other capture or export types; available choices depend on the task.
  • bwidth and bheight set browser dimensions used to render the page.
  • width and height set 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

  • delay waits a fixed period before capture. The parameter reference lists a maximum of 30,000 milliseconds; verify the live limit for your configuration.
  • waitfor waits 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.Support on Ko-Fi

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.

  1. In the browser’s onfinish callback, send the capture ID to your own endpoint over HTTPS.
  2. On the server, authenticate the caller, validate the capture ID and expected request shape, and apply your application’s authorization rules.
  3. Use your server-side GrabzIt integration to retrieve the result, then save it using a server-generated filename and an appropriate storage policy.
  4. 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.