Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows 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 reinstallDisable JavaScript before the navigation that creates the document you will capture:
await page.setJavaScriptEnabled(false);
await page.goto(url);
Puppeteer applies this setting on the next navigation. It does not undo scripts that have already run in the current document. The complete sequence, including timing, waits, screenshots and recovery for common failures, is below.
The correct sequence
Create a page, turn JavaScript off, navigate, wait for the state you need, and then capture. A minimal runnable example is:
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch({headless: true});
const page = await browser.newPage();
await page.setJavaScriptEnabled(false);
await page.goto('https://example.com', {waitUntil: 'domcontentloaded'});
await page.screenshot({path: 'page.png', fullPage: true});
await browser.close();
The key line is page.setJavaScriptEnabled(false). The API is documented in Puppeteer’s Page.setJavaScriptEnabled() reference. Because the setting takes effect on the next navigation, placing it after goto() is too late for that document.
#1 Best Overall
Why order matters
When a page is already loaded, its scripts may have changed the DOM, set cookies, started timers, issued requests or replaced content. Disabling JavaScript afterward does not rewind those effects. To capture a document without page scripts, set the flag before goto(), reload() or another navigation that creates the document.
Capturing an existing tab
If you received a page that has already navigated, disable JavaScript and navigate again:
await page.setJavaScriptEnabled(false);
await page.reload({waitUntil: 'domcontentloaded'});
await page.screenshot({path: 'without-js.png'});
A reload creates a new document, so the disabled setting can apply. Any effects from the earlier load remain in the old document only; the reload gives you a fresh page to capture.
A complete capture script with practical waits
Puppeteer does not prescribe one universal wait condition for screenshots. Choose a condition that matches the page and your capture goal. With JavaScript disabled, domcontentloaded is often a useful baseline because it waits for the HTML document to be parsed without waiting indefinitely for every subresource.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteimport puppeteer from 'puppeteer';
const target = process.argv[2] ?? 'https://example.com';
const browser = await puppeteer.launch({headless: true});
const page = await browser.newPage();
await page.setViewport({width: 1440, height: 900, deviceScaleFactor: 1});
await page.setJavaScriptEnabled(false);
try {
await page.goto(target, {
waitUntil: 'domcontentloaded',
timeout: 45_000
});
await page.screenshot({
path: 'capture.png',
fullPage: true
});
} finally {
await browser.close();
}
When a different wait is appropriate
domcontentloaded: use when the parsed HTML and styles that have arrived are the target.load: use when the screenshot should include resources whose loading contributes to the page’s load event.- A selector or explicit delay: use only when your own capture workflow needs a known element or a short settling period. JavaScript-disabled pages will not perform client-side rendering that depends on scripts, so a selector created by JavaScript may never appear.
Keep the timeout finite and handle failures so a stuck navigation cannot leave browser processes running.
What JavaScript-disabled capture can and cannot show
With JavaScript disabled before navigation, page scripts do not execute in the new document. Server-rendered HTML, CSS, images and other resources that the browser can load without page JavaScript can still appear. A single-page application that obtains its content only through client-side code may therefore render an empty shell or an incomplete view. That is a consequence of the page’s rendering model, not a Puppeteer screenshot defect.
Rank #2
Typical effects
- Client-side menus, carousels, charts and hydration do not run.
- HTML sent by the server can still be captured.
- CSS-driven layout and non-scripted images can still load, subject to normal network and page restrictions.
- Elements inserted after load by page scripts will be absent.
If you need the fully interactive state, leave JavaScript enabled and control only the unwanted resources or page behavior instead.
Do not confuse the three similar APIs
setJavaScriptEnabled(false): page-level script control
This is the documented switch for disabling JavaScript in the next document. Re-enable it with await page.setJavaScriptEnabled(true) before a later navigation when your workflow needs normal page behavior.
evaluateOnNewDocument(): change the environment before page scripts
page.evaluateOnNewDocument() runs supplied code after a document is created but before the page’s own scripts run. Puppeteer describes it as useful for amending the JavaScript environment, such as seeding Math.random. It is not the documented API for turning JavaScript off. It also applies to navigations and attached or navigated child frames.
await page.evaluateOnNewDocument(() => {
// Example environment adjustment, not JavaScript disabling:
Object.defineProperty(navigator, 'language', {get: () => 'en-US'});
});
Use this hook when scripts must run but need a controlled environment. Do not use it as a substitute for the JavaScript enablement flag.
setRequestInterception(true): network request control
Request interception lets your code continue, respond to or abort individual requests. The Puppeteer 25.12.0 request-interception guide warns that every intercepted request must be resolved; otherwise it stalls. Interception controls network resources, not whether JavaScript executes.
await page.setRequestInterception(true);
page.on('request', request => {
if (request.resourceType() === 'image') {
request.abort();
} else {
request.continue();
}
});
This example blocks images while allowing all other requests. It does not disable scripts. If your actual requirement is “no page JavaScript,” use setJavaScriptEnabled(false) before navigation and add interception only for a separate resource policy.
Frames, reloads and multiple navigations
The setting is associated with the page and takes effect when a navigation creates a document. If your workflow navigates more than once, set the desired state before each navigation or maintain it explicitly when switching between pages that require different behavior.
await page.setJavaScriptEnabled(false);
await page.goto('https://example.com/static-version');
await page.screenshot({path: 'static.png'});
await page.setJavaScriptEnabled(true);
await page.goto('https://example.com/app');
await page.screenshot({path: 'app.png'});
Child frames are separate documents. A frame that navigates as part of the page lifecycle follows the page’s JavaScript setting for that navigation. If you need to diagnose a frame, inspect page.frames() after navigation and verify which frame contains the content you expect.
Troubleshooting common failures
The page still shows JavaScript-generated content
Cause: JavaScript was disabled after the first navigation, or the screenshot was taken before a reload using the disabled setting.
Fix: call setJavaScriptEnabled(false) immediately after creating the page, then navigate or reload and capture the new document.
The screenshot is blank or missing the main content
Cause: the site is client-rendered and sends little usable HTML without scripts.
Fix: decide whether a script-free capture is actually suitable. If the rendered application is required, re-enable JavaScript and capture after the application’s own readiness condition. If a server-rendered or print endpoint exists, navigate to that URL instead.
Rank #4
waitForSelector times out
Cause: the selector is created by page JavaScript, which cannot run while disabled.
Fix: wait for a server-rendered selector, use domcontentloaded, or enable JavaScript for that capture.
Free tools Windows power users keep installed
One-click scans. No signup required.
Requests hang after adding interception
Cause: an intercepted request was not continued, fulfilled or aborted.
Fix: ensure every branch resolves the request exactly once. Remove interception entirely when you only need JavaScript disabled.
The setting appears inconsistent between captures
Cause: the workflow reuses pages and changes the flag at different points.
Fix: create a clear per-capture sequence: set the flag, navigate or reload, wait, capture. Log the URL and JavaScript state at each transition, and avoid taking a screenshot of a document loaded under a previous state.
Best Value
- Used Book in Good Condition
Navigation times out
Cause: the server, network or a subresource never reaches the selected wait condition.
Fix: use a finite timeout, choose a less demanding condition such as domcontentloaded, and close the browser in a finally block. A timeout does not mean JavaScript was re-enabled; it means the chosen navigation condition was not met.
Performance, reliability and safety considerations
Disabling JavaScript can reduce work for pages whose scripts would otherwise build an interface, but the available documentation does not establish a universal speed or reliability percentage. Treat any improvement as page-dependent rather than a guaranteed benchmark.
- Use a fresh page or an explicit reload when switching from an earlier JavaScript-enabled capture.
- Set viewport and device scale before navigation so layout-dependent screenshots are reproducible.
- Use finite navigation and screenshot timeouts and always close the browser.
- Keep request interception separate from JavaScript policy; combining them increases the number of failure paths.
- Capture the same URL and wait condition when comparing runs. Different server responses, resources or timing can change the result.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server for developers. A GET request returns a PNG, JPEG, WebP or PDF, so you do not need to maintain a Puppeteer process for a straightforward capture.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
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 all request options. Equivalent examples:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Before capture, ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.
Choosing the right approach
| Requirement | Use | Reason |
|---|---|---|
| Capture server-rendered HTML with no page scripts | setJavaScriptEnabled(false) before navigation |
Direct page-level JavaScript control for the next document |
| Change browser environment while scripts still run | evaluateOnNewDocument() |
Runs setup before page scripts, but does not disable them |
| Block images, ads or selected network resources | Request interception | Controls requests; every intercepted request must be resolved |
| Obtain a cleaned screenshot without browser orchestration | ScreenshotNeo | One HTTP call, cleanup of common overlays, verdict and billing headers |
Frequently Asked Questions
Does disabling JavaScript affect scripts that already ran?
No. The setting applies on the next navigation or reload; it does not undo execution in the current document.
Can I disable JavaScript only for one navigation?
Yes. Set it to false before that navigation, capture the page, then set it to true before a later navigation that needs scripts.
Recommended Free Tools
Why is evaluateOnNewDocument not the same as disabling JavaScript?
It injects a function before page scripts run so you can adjust the environment. Page scripts still execute unless JavaScript is separately disabled.
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.




