src attribute
The HTML attribute that gives the URL of an external resource to load, as on script, img and iframe elements.
In more detail
A script with src loads code from that URL, which Content Security Policy checks against its allowlist. The -src suffix in directive names such as script-src echoes this attribute.
Related terms
- script element — The HTML element that loads or contains JavaScript for the page.
- CSP directive — One rule inside a Content Security Policy, such as script-src, that lists the allowed sources for one kind of resource.
Taught in
- Modern Selectors: :has(), :is(), :where() And Nesting Standards — Frontend Architecture & Web Platform
- Content Security Policy (CSP), Trusted Types And XSS Defenses — Frontend Architecture & Web Platform