HTML Attributes
HTML sandbox attribute
Applies restrictions to an iframe. An empty attribute applies the full sandbox; allow-* tokens selectively relax restrictions. Combining allow-scripts with allow-same-origin for same-origin content can undermine isolation. Applicable elements include: <iframe>. Check each element’s value rules.
Formal Syntax & Structure
html syntaxhtml
sandboxParameters & Attributes
| Name | Type | Description |
|---|---|---|
| sandbox | space-separated permission tokens | Applies restrictions to an iframe. An empty attribute applies the full sandbox; allow-* tokens selectively relax restrictions. Combining allow-scripts with allow-same-origin for same-origin content can undermine isolation. |
Working Example
Example Snippethtml
<iframe title="Untrusted preview" sandbox srcdoc="<p>Preview</p>"></iframe>Browser Compatibility
Minimum supported versions across modern rendering engines
Chrome
5
Yes
Edge
12
Yes
Firefox
17
Yes
Safari
5
Yes
Checked desktop BCD snapshot: iframe sandbox base attribute; tokens differ. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted.
HTML Living Standard