Manifest V3 Complete Guide

How to Fix “Refused to Load the Script” in Chrome Extensions

Learn why Manifest V3 blocks scripts aggressively, how Chrome Content Security Policy works, and how to prevent Chrome Web Store rejections caused by CSP violations.

Real Developer Pain

The “Refused to Load the Script” Nightmare

You build a Chrome extension. Everything works perfectly during development. The popup works, the content scripts work, and the API calls behave exactly how you expected.

Then you upload the extension to the Chrome Web Store and suddenly your extension throws:

Refused to load the script 'https://cdn.example.com/script.js'
because it violates the following Content Security Policy directive:
"script-src 'self'"

Or worse — your extension gets rejected completely.

TL;DR

Manifest V3 Blocks Aggressive Script Execution

Blocked by MV3

  • External CDN scripts
  • Inline JavaScript
  • eval()
  • new Function()
  • Dynamic remote code execution

Quick Fixes

  • Bundle JavaScript locally
  • Use production builds
  • Remove inline scripts
  • Disable eval-based source maps
  • Avoid remote script injection
Content Security Policy

What Is Content Security Policy (CSP)?

Content Security Policy is a browser security mechanism that controls what JavaScript can execute and where scripts can load from.

"content_security_policy": {
  "extension_pages": "script-src 'self'; object-src 'self'"
}
AllowedBlocked
Local bundled scriptsCDN scripts
Static importsInline scripts
Service workersDynamic execution
Extension assetsRemote executable code

Most Common Mistakes That Cause CSP Errors

External CDN Scripts

Using external <script src='https://...'> inside extension pages.

Inline JavaScript

Using inline <script> tags or onclick handlers in popup HTML.

eval() & new Function()

Bundlers inject eval-based source maps that violate MV3 CSP.

Analytics SDKs

Third-party analytics often dynamically load remote scripts.

Remote Script Injection

Injecting scripts from external URLs into webpages.

Why Extensions Work Locally But Fail After Packaging

During development, tools like Vite and Webpack inject scripts, use eval-based source maps, and allow localhost behavior that works temporarily.

After packaging, Manifest V3 applies strict CSP rules and Chrome reviewers scan the built output directly.

// NEVER use in MV3 production builds
devtool: 'eval'

// Correct configuration
module.exports = {
  mode: 'production',
  devtool: 'source-map'
}
Chrome Review System

How Chrome Reviewers Detect These Problems

Chrome Web Store review is heavily automated. Google uses static analysis systems that scan extension packages for unsafe patterns.

  • eval(
  • new Function(
  • unsafe-eval
  • external scripts
  • remote loaders
  • obfuscated code
  • suspicious permissions

The Complete MV3 CSP Fix Checklist

No external CDN scripts
No inline scripts
No inline event handlers
No eval()
No new Function()
No javascript: URLs
All dependencies bundled locally
Production mode enabled
No eval-based source maps
Proper chrome.scripting usage
Manifest V3 validated
CSP compliant build output
Secure Development

Best Practices for Manifest V3 Development

Bundle everything locally

Prevents remote execution and policy violations.

Never use eval()

Chrome treats eval usage as a major security risk.

Avoid inline JavaScript

Inline execution violates MV3 Content Security Policy.

Build in production mode

Prevents eval-based source maps from appearing in builds.

Validate before submission

Catch rejection triggers before reviewers do.

FAQ

Why does Manifest V3 block external scripts?

Because remote scripts can change extension behavior after review, making extensions unsafe.

Can Chrome extensions use CDN JavaScript?

No. Manifest V3 blocks remotely hosted executable scripts.

Is eval() allowed in Chrome extensions?

No. eval() and new Function() violate MV3 CSP rules.

Why does my extension work locally but fail in production?

Development builds often inject eval-based code or localhost scripts that are blocked in production.

How can I avoid Chrome Web Store rejection cycles?

Validate your extension before submission using automated MV3 validation tools.

Related Articles

Explore more Chrome extension development and Manifest V3 guides.

Chrome Extension Validation

Validate Your Extension Before Submission

ExtGuard is a complete Chrome extension building pipeline. Generate extension ideas, build production-ready extensions, validate Manifest V3 compliance, detect CSP violations, scan permissions, and prevent Chrome Web Store rejection risks — all in one workflow before you ever submit your extension.