Refused to execute inline script because it violates the Content Security Policy
The page's Content-Security-Policy forbids inline scripts, so the browser blocked yours.
Refused to execute inline script because it violates the following Content Security Policy directiveRefused to execute inline event handler because it violates the following Content Security Policy directiveContent-Security-Policy: The page's settings blocked an inline script (script-src-elem)'unsafe-inline' is ignoredviolates CSP directive script-src Meaning
CSP without 'unsafe-inline' blocks inline <script> and onclick= handlers. Move scripts into files, or allow specific inline blocks with a nonce (script-src 'nonce-...') or hash. Check the console for the exact directive and the report-only mode to test.
Common causes
script-src 'self'without nonce/hash- Inline script or event-handler attribute
- Third-party snippet injecting inline code
- CSP header added by a proxy/plugin
- Missing nonce in the rendered tag
⚡ Quick fix
- Move inline code into external files
- Add a per-request nonce and put it on trusted tags
- Use
Content-Security-Policy-Report-Onlyto test changes
Detailed fix by platform
HTTP
Content-Security-Policy: script-src 'self' 'nonce-r4nd0m'
How to diagnose
- Directive — script-src?
- Nonce — On the tag?
- Inline — Needed?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in HTTP
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026