Performance: Content Security Policy
MEDIUM IMPACT
Content Security Policy (CSP) affects page load speed by controlling which resources the browser can load, impacting render-blocking and resource fetching.
CSP_HEADER = "default-src 'self'; script-src 'self' https://trusted.cdn.com; style-src 'self' https://trusted.cdn.com"CSP_HEADER = "default-src *; script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline'"| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Permissive CSP allowing all sources | No direct DOM impact | Multiple reflows due to many external resources | High paint cost from many resources | [X] Bad |
| Strict CSP limiting to self and trusted domains | No direct DOM impact | Fewer reflows due to limited resources | Lower paint cost from fewer resources | [OK] Good |