Security & Privacy
sandbox="allow-scripts"
Permits script execution inside the frame, subject to other policies such as CSP. It does not independently allow same-origin access, popups or top-level navigation; grant only the capabilities needed. A space-separated token list on iframe. An empty sandbox imposes the full sandbox restrictions; each token removes a particular restriction, not all restrictions. This inert srcdoc demonstrates syntax only, not the granted capability.
Formal Syntax & Structure
html syntaxhtml
sandbox="allow-scripts"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| sandbox | space-separated token list | Permits script execution inside the frame, subject to other policies such as CSP. It does not independently allow same-origin access, popups or top-level navigation; grant only the capabilities needed. |
Working Example
Example Snippethtml
<iframe title="Isolated example" sandbox="allow-scripts" srcdoc="<p>Embedded content</p>"></iframe>Browser Compatibility
Minimum supported versions across modern rendering engines
Chrome
5
Yes
Firefox
≤49
Yes
Safari
5
Yes
Checked desktop BCD snapshot: iframe sandbox token allow-scripts. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted. Token support does not guarantee permission to perform the action in every context.
HTML Living Standard