Master Site-Specific JavaScript: Get Pages Working Without Enabling Everything in 30 Minutes
You're trying to make a website work, but you don't want to give every script on the page a free pass. Good. That sense of caution will save you from tracking, bugs, and sketchy third-party code. In about half an hour you can go from "nothing loads" to "this site runs, and only the scripts I trust run." You'll be able to:
- Identify which domains serve required scripts for a page. Whitelist only those domains in your browser or blocker so the site functions. Use per-site settings or extensions to avoid turning all JavaScript back on. Troubleshoot common blockers like Content Security Policy, cached Service Workers, and extension rules.
I'll walk you through practical steps you can do on your machine, whether you're the end user or the site admin trying to keep things secure but functional.
Before You Start: Browsers, Extensions, and Domains to Gather
Stop. Gather these items before you start fiddling. If you try random changes without a list, you'll waste time and break unrelated sites.
- Browser name and version - Chrome/Edge (Chromium-based) have native per-site JavaScript controls. Firefox and Safari often rely on extensions for fine-grained script control. Active blocker extensions - NoScript, uBlock Origin, Ghostery, Privacy Badger, ScriptSafe, AdGuard. Know which ones are running and their rules for the site you're testing. List of domains the page loads scripts from - Your-site.com, cdn.example.com, analytics.tracker.net, fonts.googleapis.com, etc. We'll generate that list next. Access to developer tools - Open DevTools (F12 or Cmd-Opt-I) and keep the Console and Network tabs ready. Ability to clear cache and unregister Service Workers - We'll use that to force a fresh load when things look stuck.
If you're the site owner, also have access to your server or CDN headers so you can change Content-Security-Policy (CSP) values.
Your Complete Site JavaScript Roadmap: 7 Steps to Whitelist and Enable Scripts Selectively
Here is a practical sequence. Do them in order. I know it feels obvious, but skipping a step is what makes people scream into the void when a site still won't load.

Start with a clean slate. Most browsers let you open a private window that disables most extension persistent settings. If the site works there, an extension is blocking scripts. If it still breaks, it's likely a browser setting, CSP, or a server problem.
Use DevTools to list script domains.Open Network tab and filter by "JS" or by resource type. Reload the page and note every domain that serves a .js file or a script resource. Also watch for XHR/fetch calls that point to API domains you'll need for functionality. Make a short list like:
- your-site.com cdn.jsdelivr.net fonts.gstatic.com (if fonts are blocked the layout might fail) analytics.example.net
In Chrome/Edge: Settings > Privacy and security > Site Settings > JavaScript > Add the site under Allow. In Firefox, use an extension like NoScript or uBlock Origin's dynamic filtering because there is no straightforward per-site JS toggle. Safari users might need to use the "Settings for This Website" dialog or a content blocker extension.
Allow only your-site.com first. Reload. Does core content render? If yes, the rest are third-party extras. If not, see the Console for exact blocked resource errors like CORS or CSP violations.
Whitelist additional third-party domains one by one.Add the CDN that delivered your main JS bundle. Reload. If the UI appears, add the next third-party (fonts, analytics, payment gateways) only if needed. For extensions like uBlock Origin or NoScript, use the logger to see which requests are blocked and adjust rules to Allow or Temp-Allow specific domains.
Handle inline scripts and eval protections via CSP awareness.If the Console shows "Refused to execute inline script because of Content Security Policy", you need to either change the CSP header (site owner) or allow the specific source. As a quick test, disabling CSP enforcement in developer tools can show whether the site depends on inline scripts. As a long-term fix, migrate inline code to external files with nonces or hashes in the CSP header.
Clear caches and unregister Service Workers.A Service Worker or old cached script can keep you stuck. In DevTools Application tab, unregister any Service Workers and clear site data. Then reload with a hard refresh (Ctrl-Shift-R or Cmd-Shift-R).
Lock down final rules and document them.Once the minimum domains are allowed and the site works, write down the whitelist and any extension rules. Treat this like a mini-runbook so you or others can reproduce the setup later.
Quick Win: Get the Page Working in Under Two Minutes
If you're impatient and want the site to work now: open a private window, disable all extensions, allow JavaScript globally for that session, then reload. If it loads, re-enable extensions one at a time until the site breaks to find the culprit. This finds the problem fast without guesswork.

Avoid These 7 Mistakes That Break Site Scripts
Here's the short list of dumb things people do that make sites fail. Avoid them like you avoid opening an email titled "URGENT: Update Your Account".
- Whitelisting wildcards too broadly - Allowing *.example.com seems convenient but pulls in subdomains you didn't intend, like ads.example.com. Prefer explicit hostnames. Forgetting subdomains - cdn.example.com and assets.example.com are different. If a script loads from a subdomain you didn't whitelist, it fails. Assuming file extensions tell the whole story - Scripts can come from JSON endpoints or be injected via eval. Watch XHR and inline script errors in the Console. Not checking CSP errors - The Console will tell you "Refused to load the script" and the policy that blocked it. Read it. It literally tells you what to change. Leaving global JavaScript enabled forever - It makes future debugging impossible. Use per-site rules or temporary allowances, then lock them down. Backing out changes in the wrong order - Turning off a Service Worker without clearing caches leaves stale scripts lying around. Unregister then clear. Over-trusting extension logs - Some blockers show a network request as blocked when the real block is CSP from the server. Cross-check with the browser Console.
Pro Browser Hacks: Advanced Domain Whitelisting and Script Management
Now for the tricks people only learn after they break things a few times. These are for power users and admins who want control without pain.
Use dynamic filtering, not blunt on/off switches
Extensions like uBlock Origin have a dynamic filtering mode that lets you allow or block scripts, frames, xhr, and other resource types per domain. Rather than toggling "JavaScript on/off", allow scripts from the main site and the specific CDN domain that serves your bundles. That gives high security and minimal breakage.
Content-Security-Policy with nonces or hashes
If you maintain the site, move away from 'unsafe-inline'. Use a CSP that lists trusted script-src hosts and add nonces to inline scripts. Example header:
That lets you permit inline code only when it has a matching nonce. It sounds fiddly, but it stops injected scripts from running.
Dev trick - override CSP in the browser for quick testing
In Chrome DevTools, you can disable CSP under Settings - Preferences - Security to test whether CSP is the problem. Do not run your browser like that all the time. It's for debugging only.
Hosts file and local proxy for surgical blocking
If you need to block or reroute a domain entirely for testing, use your hosts file or a local proxy like Fiddler/Charles. Point a blocked domain at localhost to see how the site behaves without it. That is cleaner than guessing extension rules.
Contrarian View: Blocking everything is not the same as being secure
Some security purists block all third-party scripts by default. That reduces tracking, yes. It also masks real problems. If you run an ecommerce site and you block your payment processor while testing, you might conclude the site is broken when it's your policy causing the failure. The better managing twitter access problems path: block, but document expected third-party dependencies and keep test profiles where you allow them. Security and functionality are twin responsibilities, not opponents.
When Site Scripts Fail: Fixing Blocking, CSP, and Caching Issues
Okay, things still broke. That is normal. Here is a checklist to methodically track the problem down.
Read the Console messages first.Errors like "Refused to load the script 'https://...' because it violates the following Content Security Policy directive" tell you exactly which policy is blocking the request. If you see "Blocked by client" or "net::ERR_BLOCKED_BY_CLIENT", that's likely an extension blocking the request.
Confirm the offending domain in Network tab.Find the failing request, inspect its response headers. If you see CSP headers returned, you're looking at server-side restrictions. If the request never leaves the browser, it's an extension rule or local block.
Temporarily disable blockers and reproduce the failure.If turning off the blocker makes it work, re-enable the blocker and use its log to find the rule you need to relax - not widen everything.
Clear Service Worker and caches when files don't update.Old scripts served by a Service Worker will keep the old behavior. Unregister it in DevTools - Application - Service Workers and clear site data.
Check cookie and same-site restrictions for third-party APIs.Third-party services increasingly require SameSite=None and secure cookies. If an API fails to authenticate, look at Set-Cookie headers and request cookies in Network tab.
Use a second device or a staging environment to isolate variables.If the site works on one machine but not another, you have a local configuration problem - extensions, hosts file, or proxy settings. If it fails on all machines, it's server-side.
Capture and compare requestsUse the HAR export feature from DevTools to capture both a working and a failing load. Compare headers, cookies, and request timelines to spot differences.
When to escalate to the site owner or dev team
If you see CSP errors pointing to 'self' but the scripts are correctly hosted on your origin, that means the CSP is misconfigured - a dev must fix it. If a payment or authentication domain is failing due to SameSite cookie policies, contact the API owner. Provide them with Console messages and HAR files. Those details are more helpful than "it doesn't work".
You're done. You now know how to find the domains a site relies on, allow just those domains, and avoid the traps that make you flip JavaScript back on everywhere. Be methodical: gather the domains, test in a clean session, add one domain at a time, and document the rules. If you keep a test profile where you can safely allow everything for debugging, you'll save time and frustration in the long run.
If you want, tell me the browser and the specific site that's failing and I'll give step-by-step rules to enter into Chrome, Firefox (NoScript/uBlock), or Edge. Don't describe the site as "it doesn't work" - paste the Console error and the list of script domains and we'll sort it quickly.