Enable JavaScript and Cookies to Continue: Scraper Fix
Hit 'Enable JavaScript and cookies to continue' when scraping? Learn what the page checks, when a real browser with a cookie jar passes it, and what to do next.

You sent a GET with requests, and instead of the product page you got a few kilobytes of HTML whose only readable sentence is enable JavaScript and cookies to continue. Scraping tools hit this constantly, and the instinct is to retry, rotate the IP and retry again. That loop never works, because the page isn't asking your client to try harder. It's asking for something a plain HTTP client can't give it: a JavaScript engine that runs the challenge script and a cookie jar that keeps the result. This guide shows how to confirm what you're facing in one request, when a real browser with a cookie jar is enough, and when to stop and identify the vendor instead.
The page, word for word
Here is what a Cloudflare managed challenge returned to a plain requests 2.34.2 GET on 2026-10-31, measured by us against a public Cloudflare challenge test page:
HTTP/1.1 403 Forbidden
Content-Type: text/html; charset=UTF-8
Cf-Mitigated: challenge
Server: cloudflare
<title>Just a moment...</title>
...
<noscript>Enable JavaScript and cookies to continue</noscript>
...
<script>(function(){window._cf_chl_opt = { ... cType: 'managed', ... }
Four things in that response matter more than the sentence itself:
- Status 403, not 200. Many scrapers treat 403 as "banned" and give up; here it means "challenged".
Cf-Mitigated: challenge. Cloudflare's own docs say this header is present on every Challenge Page response and thatchallenge"is the only valid value". It is the single most reliable test you have.- The
text. "Enable JavaScript and cookies to continue" sits inside, so a real browser never shows it. Your scraper sees it because it doesn't run scripts. Cloudflare's custom challenge page template in its docs uses nearly the same wording: "Please enable JavaScript and cookies to continue." _cf_chl_optwithcType: 'managed'. The challenge script and its configuration. "Managed" means Cloudflare picks the challenge type per request.
The whole body was 5,440 bytes. Nothing in it is the page you wanted, and parsing it with BeautifulSoup just gives you empty selectors.
What the interstitial is actually checking
Cloudflare describes challenge pages as "a full-page screen that appears before the visitor reaches the destination URL" and says the non-interactive variant checks browser signals "with injected JavaScript", typically in under five seconds. Read the wording on the page literally and it lists the two requirements:
- JavaScript. The challenge script runs in the client, collects signals from the browser environment and reports back. A client that doesn't execute JavaScript sends nothing back, so it can never pass. No header, User-Agent string or TLS fingerprint substitutes for executing the script.
- Cookies. When the check passes, the site sets a clearance cookie. On Cloudflare that's
cf_clearance, which the docs describe as proof "that the visitor is a verified human". Every later request has to carry it, or you're challenged again.
The docs add one more property that decides how you can reuse it: the cookie "is securely tied to the specific visitor and device it was issued to, preventing reuse across machines." Cloudflare doesn't publish which attributes form that binding. Our own test below shows the User-Agent is one of them.
So the interstitial is a two-step handshake: prove you run a browser, then keep the token you were given. A real browser with a persistent cookie jar does both by default. That's why the same URL loads fine in Chrome on your laptop.
Scraping at scale? Skip the blocks.
Fast, unblockable datacentre proxies with unlimited bandwidth.
Diagnosis order: cheapest check first
Run these in order. Each step is cheaper than the next, and each one either ends the investigation or tells you which fix applies.
| # | Check | Cost | If yes | If no |
|---|---|---|---|---|
| 1 | Response has `cf-mitigated: challenge`? | One request | Cloudflare challenge: go to step 3 | Go to step 2 |
| 2 | Body sets a cookie in inline JS and reloads (`document.cookie=` plus `location`)? | Read the HTML | Fix A, no browser needed | Unknown vendor: identify it |
| 3 | Does the URL load in desktop Chrome on your own machine? | Thirty seconds | Fix B is viable | The site blocks your network or region |
| 4 | Does a headed Playwright browser on the scraping host pass? | One script run | Fix B, then the cookie handoff | Fix C |
| 5 | Does it pass headless on the same host? | Same script, one flag | Run headless in production | Stay headed under a virtual display, or use the API |
The first two checks fit in a few lines of Python:
import re
import requests
URL = "https://shop.sparkproxy.io/category/laptops"
r = requests.get(URL, timeout=20)
body = r.text
print("status:", r.status_code)
print("cf-mitigated:", r.headers.get("cf-mitigated"))
print("server:", r.headers.get("server"))
print("title:", re.search(r"<title>(.*?)</title>", body, re.S | re.I))
print("cloudflare challenge script:", "_cf_chl_opt" in body)
print("inline cookie-set + reload:",
bool(re.search(r"document\.cookie\s*=", body))
and bool(re.search(r"location\.(reload|href|replace)", body)))
print("noscript wall:", "enable javascript and cookies" in body.lower())
If cf-mitigated comes back as challenge, stop guessing about headers. You have a Cloudflare challenge and the fix is a browser. If it's absent and there's no inline cookie trick either, a different vendor is wording the same request, and the guide to identifying which anti-bot a site uses will name it from headers and cookie names in a few minutes.
Why a retry loop can't pass it
We sent the same challenge URL through four clients on 2026-10-31 from one Windows Server host:
| Client | Status | `cf-mitigated` | Got `cf_clearance`? |
|---|---|---|---|
| `requests` 2.34.2 | 403 | challenge | No |
| `curl_cffi` 0.16.3, `impersonate="chrome"` | 403 | challenge | No |
| `curl_cffi` 0.16.3, `impersonate="safari"` | 403 | challenge | No |
| Playwright 1.63.0 driving Chrome 156, headed | 403, then passed in about 3 s | challenge on first load | Yes |
TLS impersonation didn't change anything here, because this challenge isn't judging the handshake alone. It wants the script executed. Rotating the exit IP between retries makes it worse, not better: every new IP starts from zero, with no clearance cookie and no history. A retry loop without a JavaScript engine is the same failed request sent many times.
Treat this as one test page on one day, not a general pass rate. Your target may be configured more strictly.
Fix B: let a real browser earn the clearance
For a Cloudflare challenge, the fix is to send a real browser through the challenge and keep the cookie jar it fills. Use installed Chrome through Playwright, wait for the title to stop saying "Just a moment...", and save the browser's storage state so the next run starts with the clearance:
from playwright.sync_api import sync_playwright
URL = "https://shop.sparkproxy.io/category/laptops"
PROXY = {
"server": "http://gateway.sparkproxy.io:11002", # Sticky Sessions port
"username": "USERNAME",
"password": "PASSWORD",
}
with sync_playwright() as p:
browser = p.chromium.launch(
channel="chrome",
headless=False,
proxy=PROXY,
args=["--disable-blink-features=AutomationControlled"],
)
ctx = browser.new_context(locale="en-US")
page = ctx.new_page()
page.goto(URL, wait_until="domcontentloaded")
# The challenge replaces itself with the real page when it passes.
page.wait_for_function(
"!document.title.includes('Just a moment')", timeout=30_000
)
names = [c["name"] for c in ctx.cookies()]
print("cleared:", "cf_clearance" in names, names)
ctx.storage_state(path="clearance_state.json")
html = page.content()
browser.close()
Three details in that script are deliberate:
- One browser context for the whole job. The context is the cookie jar. Opening a fresh context per URL throws the clearance away and pays the challenge again on every page.
- Sticky Sessions on port 11002. The clearance is bound to the client that earned it. Keeping the same exit IP for the session removes one variable. Random Rotation on port 11000 would move you to a new IP on the next connection, which is the wrong tool for a session that carries a token.
storage_stateto disk. The next run loads it withbrowser.new_context(storage_state="clearance_state.json")and usually skips the interstitial until the clearance expires. Its lifetime is set by each site owner (Cloudflare calls it Challenge Passage), so measure it on your target rather than assuming a number.
For the general mechanics of cookie jars, persistence and why a received cookie sometimes isn't sent back, see our guide to handling cookies and sessions when scraping.
Fix C: the browser itself never gets through
In our run, headless Chrome sat on "Just a moment..." for the full 30-second window, twice, with and without the automation flag. Headed Chrome with the same code and IP passed in about three seconds. That's one measurement, but it matches a broader pattern: headless mode leaks signals the challenge script can read. The headless browser detection guide lists them, so we won't repeat them here.
If your browser stays stuck, work through it in this order:
- Run headed. On a Linux server, run the browser headed inside a virtual display (
xvfb-run python clear.py). It costs some memory and fixes the most common cause. - Check the network, not the browser. Load the URL in a normal Chrome on the same host or through the same proxy. If that also loops, the site is challenging the IP range, and no browser setting changes that.
- Check for an interactive step. If the page shows a checkbox or widget, it has escalated past a non-interactive check. That's Turnstile territory; the Cloudflare Turnstile guide covers it.
- Stop adding retries. Repeated failed challenges from one identity don't improve its standing. Pause, change one variable, test once.
Beyond this point, stacking stealth patches without knowing which detector you face is guesswork. Our guide to bypassing Cloudflare when scraping covers the full detection stack (TLS, JavaScript challenges, IP reputation) and is the right next read.
The Scraping API route, with marker detection
If you'd rather not run browsers, the SparkProxy Scraping API renders pages for you. render_js defaults to true (5 credits), so a default request already runs the page's JavaScript in a browser on our side. Ask for json_response=true to get the envelope, and check the decoded body for the challenge before you parse it:
import base64
import requests
API = "https://scrape.sparkproxy.io/api/v1"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
MARKERS = (
"enable javascript and cookies to continue",
"<title>just a moment...</title>",
"_cf_chl_opt",
)
params = {
"url": "https://shop.sparkproxy.io/category/laptops",
"render_js": "true",
"wait_for": ".product-card",
"json_response": "true",
}
env = requests.get(API, headers=HEADERS, params=params, timeout=200).json()
# The envelope body is base64. Decode it before matching anything.
html = base64.b64decode(env["body"]).decode("utf-8", errors="replace")
challenged = any(m in html.lower() for m in MARKERS)
print("target status:", env.get("status_code"))
print("credits used:", env.get("credits_used"))
print("challenged:", challenged)
Two mistakes to avoid. Don't use format=json for this: format only converts content (html, md, mdx, json, screenshot, pdf) and doesn't produce the envelope. And don't match markers against the raw envelope, because the body inside it is base64 and will never contain "Just a moment".
wait_for gives up after 30 seconds, which is long enough for a non-interactive check to finish and the real page to replace it. If the decoded body still shows the challenge, change one thing per attempt: add proxy_type=premium (25 credits with JavaScript, per the docs), or stealth=true (+5 credits), which adds a homepage pre-warm and longer idle delays. Each costs more per request, so don't make them the default. Failed jobs are refunded, but a challenge page served with a valid response is a response, so the marker check is what tells you whether you got data. New accounts get 1,000 free credits to test against a real target first.
Which causes a proxy can fix
A proxy changes where your traffic comes from. It does not run JavaScript or keep cookies. Map that onto the causes above:
| Cause | Does a proxy fix it? | What does |
|---|---|---|
| Client doesn't execute JavaScript | No | A browser or `render_js=true` |
| Clearance cookie not stored or not sent | No | One persistent browser context or session |
| Clearance rejected because the client changed | Partly: a sticky exit keeps the IP constant | Same context, same User-Agent, same Sticky Sessions IP |
| Every session from your server's IP range is challenged | Yes, if the target accepts the new range | A different exit, tested with a real browser |
| Headless signals detected | No | Headed browser or a managed renderer |
| Rate limiting after the clearance | Yes | Spread load across Random Rotation exits with separate sessions |
SparkProxy plans include unlimited bandwidth and start from $75/month (USD, read from sparkproxy.io on 2026-10-09), so the extra page loads a browser makes during a challenge don't change the bill. Plans are priced by pack and concurrency, not per gigabyte. You get 1M+ premium IPs in 80+ countries over HTTP, HTTPS and SOCKS5, with a 24-hour free trial and no credit card.
When to stop and identify the vendor
The rule is simple. If a headed real browser with one persistent cookie jar passes the interstitial on your scraping host, you're done: run Fix B, add the handoff if you need speed, and re-mint the clearance when it expires.
If it doesn't pass, the problem isn't "JavaScript and cookies" any more, whatever the page says. Something else is failing: IP reputation, a headless tell, an interactive challenge or a vendor other than Cloudflare using similar wording. That's the moment to name the vendor with the anti-bot identification guide and follow its vendor-specific guide: Cloudflare, DataDome, Akamai, PerimeterX or Imperva. A bigger retry budget is never the next step.
Before you scrape any protected site, check its terms and robots.txt, and keep request rates at a level that doesn't burden it.
Frequently asked questions
FAQ
Your scraper doesn't execute JavaScript, so it receives the challenge page's fallback text. Chrome runs the challenge script, receives a clearance cookie and loads the real page, so you never see that sentence in a browser.
Check the response for a cf-mitigated: challenge header. Cloudflare documents it as present on every Challenge Page response, usually alongside a and a _cf_chl_opt script block.
Not on its own, because requests can't run the challenge script. It can reuse a clearance that a real browser earned, provided you copy the browser's cookies and its exact User-Agent and keep the same exit IP. That held on our test page but may not on stricter sites.
No. A new IP arrives with no clearance cookie, so it gets challenged again. Use Sticky Sessions for the session that holds the clearance and save rotation for spreading load once you're through.
The site owner sets it through Cloudflare's Challenge Passage setting, so it varies by site. Save the browser's storage state, watch for the challenge header to return, and re-mint the clearance when it does.
Sometimes, but not reliably. In our test, headless Chrome stayed on the challenge for 30 seconds while headed Chrome on the same host passed in about three. Run headed under a virtual display if headless gets stuck.
Get 20% off your first month
Premium datacentre proxies with unlimited bandwidth. Use the code at checkout.
Save up to 15% more on quarterly, half-yearly and yearly plans
Related articles

cf_clearance Cookie Explained: What Cloudflare Stores
The cf_clearance cookie explained from Cloudflare's docs: clearance levels, lifetime, Precursor, Turnstile pre-clearance, attributes, and what it's tied to.

Web Bot Auth: Sign Your Agent's HTTP Requests
Web Bot Auth explained and implemented: Ed25519 keys, the key directory, RFC 9421 signatures in Python and Node, who verifies them, and the header format trap.

Browser Does Not Support SOCKS5 Proxy Auth: Fix
Fix Playwright's 'Browser does not support socks5 proxy authentication' and Puppeteer's ERR_NO_SUPPORTED_PROXIES: why Chromium can't, and three tested fixes.
