inline script
JavaScript written directly inside a script tag or an event attribute such as onclick, rather than loaded from a file.
In more detail
Moving code into separate files makes a strict policy much easier to apply. A strict Content Security Policy blocks inline scripts unless they carry the right nonce or hash, because injected attacks usually arrive as inline code.
Related terms
- nonce — A value meant to be used only once, such as a unique number given to a cipher or a random token that marks trusted scripts in a web page.
- 'unsafe-inline' — A CSP keyword that allows all inline scripts or styles, which removes most of the protection CSP offers against XSS.
- Content Security Policy — An HTTP response header that tells the browser which sources of scripts and other content a page may load, limiting what injected markup can do.
- streaming SSR — Server-side rendering that sends the HTML shell immediately and streams the rest of the page as each piece of data becomes ready.
- next/script — The Next.js Script component, which loads third-party JavaScript with a chosen strategy so it does not block the page.
Taught in
- Content Security Policy (CSP), Trusted Types And XSS Defenses — Frontend Architecture & Web Platform
- Streaming SSR: Progressive HTML & Chunked Transfers — Next.js 15 & Modern App Router Architecture