files/en-us/web/http/reference/headers/content-security-policy/script-src-elem/index.md
The HTTP {{HTTPHeader("Content-Security-Policy")}} (CSP) script-src-elem directive specifies valid sources for JavaScript {{HTMLElement("script")}} elements.
This directive only specifies valid sources in <script> elements (both script requests and blocks).
It does not apply to other JavaScript sources that can trigger script execution, such as inline script event handlers (onclick), script execution methods gated on the "unsafe-eval" check, and XSLT stylesheets.
(Valid sources can be specified for all JavaScript script sources using {{CSP("script-src")}}, or just for inline script handlers using {{CSP("script-src-attr")}}.)
Content-Security-Policy: script-src-elem 'none';
Content-Security-Policy: script-src-elem <source-expression-list>;
This directive may have one of the following values:
'none'
<source-expression-list>
'unsafe-hashes'.script-src-elem can be used in conjunction with {{CSP("script-src")}}:
Content-Security-Policy: script-src <source>;
Content-Security-Policy: script-src-elem <source>;
Given this CSP header:
Content-Security-Policy: script-src-elem https://example.com/
…the following script is blocked and won't be loaded or executed:
<script src="https://not-example.com/js/library.js"></script>
{{Specifications}}
{{Compat}}