Uncaught EvalError: Refused to evaluate a string as JavaScript

JS eval error on Google search? Here's the real fix

You're seeing this in the console because a browser extension or security tool blocks eval(). I'll walk through the fix from quickest to driest.

The Short Version (30 seconds)

This error shows up when something—usually a browser extension—blocks JavaScript from using eval(). Google Search legitimately uses eval for some dynamic content loading. A security tool or ad blocker is stepping on it.

First try: Open a private/incognito window. Load Google and search something. If the error's gone, it's an extension. If not, skip to the moderate fix below.

Had a client last month whose IT department pushed a 'security' extension. Took me 30 seconds to find by opening a private window. They thought their browser was broken. Nope.

The Moderate Fix (5 minutes)

Private window worked? Good. Now we hunt the culprit.

Disable extensions one by one

  1. Open Chrome menu → More Tools → Extensions (or chrome://extensions)
  2. Toggle each extension off, then test Google Search
  3. Common offenders: ad blockers (uBlock Origin, AdBlock Plus), privacy tools (Privacy Badger, Ghostery), and script blockers (NoScript, ScriptSafe)

In Firefox, go to about:addons and do the same. I've seen uBlock Origin's "advanced user mode" block eval even on trusted sites. If you find the culprit, either disable it on Google or adjust its settings.

Check for malware extensions

Sometimes a shady extension slips in. Look for anything you don't recognize. I had a client whose browser had three 'Weather' extensions from unknown publishers. One was injecting ads and blocking eval. Remove anything suspicious.

The Advanced Fix (15+ minutes)

Still seeing the error in a clean browser window? Or you're not using any extensions? Then something else is modifying your browser's security settings or network traffic.

Reset Chrome flags

If you've messed with chrome://flags, some experimental features can break eval. Hit chrome://flags, click "Reset all to default", restart the browser. This is rare but I've seen it twice.

Check group policies (Windows/Mac)

Corporate machines often have enforced security policies that block eval. On Windows, open gpedit.msc and look under Computer Configuration → Administrative Templates → Google Chrome → Content Settings. If "Disable JavaScript" or "Block eval" is enabled, you need IT to change it.

On Mac, check /Library/Managed Preferences/com.google.Chrome.plist. If you see JavaScriptAllowed set to false, that's your problem.

DNS or proxy interference

Rare, but some corporate proxies or DNS filters inject headers that tighten CSP (Content Security Policy). Open Developer Tools → Network tab, reload Google Search, and look at the response headers. If you see Content-Security-Policy: script-src 'self' without 'unsafe-eval', that's blocking eval.

Test by temporarily bypassing the proxy (if allowed). Alternatively, use a VPN to bypass DNS-level filtering. I had a client in a shared office where the landlord's router injected CSP headers. We swapped DNS to Cloudflare and it fixed everything.

Malware scanning

If none of this works, run a full malware scan. There's malware that manipulates browser settings at the system level. Use Malwarebytes or Windows Defender offline scan. I've seen a browser hijacker that blocked eval to force users onto their ad-filled search result pages.

When to ignore the error

If Google Search works fine and the error only shows in the console (F12), you can safely ignore it. It's a warning, not a show-stopper. But if pages load slowly or parts of Google are broken (like autocomplete), fix it.

One last thing: if you're a developer and you see this on your own site, you need to add 'unsafe-eval' to your CSP's script-src directive. But for Google Search, that's not your problem.

Related Errors in Linux & Unix
bash: command not found Bash: command not found: fix PATH and shell config mount: /mnt: special device /dev/sdb1 does not exist Fix 'mount: /mnt: special device /dev/sdb1 does not exist' null System Clock Drift Detected on Linux – Quick Fix ENOSPC Fix 'No space left on device' When inodes, not disk, are full

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.