Global Attributes
HTML nonce attribute
Matches a CSP nonce source to authorize an eligible script or style. Generate a fresh unpredictable value per response; never reuse a fixed example nonce in production. Applicability: global HTML attribute, subject to element-specific restrictions and browser support. Example is a markup pattern requiring the indicated component, resource or server configuration.
Formal Syntax & Structure
html syntaxhtml
nonce="SERVER_NONCE"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| nonce | server-generated unpredictable token | Matches a CSP nonce source to authorize an eligible script or style. Generate a fresh unpredictable value per response; never reuse a fixed example nonce in production. |
Working Example
Example Snippethtml
<!-- Template fragment: replace SERVER_NONCE with the actual response nonce. --><script nonce="SERVER_NONCE">console.log('Ready');</script>Browser Compatibility
Minimum supported versions across modern rendering engines
Chrome
61
Yes
Firefox
75
Yes
Safari
15.5
Yes
Checked desktop BCD snapshot: global nonce attribute. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted. Firefox 31–74 and Safari 15.4 had incomplete protection against nonce extraction through content attributes; this is not full CSP verification.
HTML Living Standard