HTML
Example
with extra restrictions
Try it »
(More examples are at the bottom of the page)
Browser support





Internet Explorer 10, Firefox, Chrome, and Safari support the sandbox attribute.
**Note:** Opera and Internet Explorer 9 and earlier versions do not support the sandbox attribute.
Definition and Usage
If an empty string is specified (sandbox=""), the attribute enables some additional restrictions on the content displayed in the iframe.
The value of the sandbox attribute can be either an empty string (which enables all restrictions) or a space-separated list of specified strings.
HTML5 improves the security of iframes through the sandbox attribute. The sandbox attribute can prevent untrusted web pages from performing certain actions.
Ian Hickson, editor of the HTML5 specification, discussed the benefits of sandbox, which can prevent the following actions:
- Accessing the DOM of the parent page (technically, this is because the iframe has become a different origin relative to the parent page)
- Executing scripts
- Embedding its own forms or manipulating forms via scripts
- Reading from or writing to cookies, local storage, or local SQL databases
Differences between HTML 4.01 and HTML5
The sandbox attribute is new in HTML5.
HTML