Content Security Policy
Concept Check Medium
Question
What is the primary purpose of a Content Security Policy (CSP)?
Hint
It is a security header that controls resource loading.
Explanation
CSP is an HTTP header that lets you specify which sources the browser is allowed to load resources from. For example, 'script-src self' only allows scripts from the same origin. CSP is a powerful defense against XSS and data injection attacks by restricting what can execute on the page.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.