IFrame sandbox Property
Example
Return the value of the sandbox attribute:
var x = document.getElementById("myFrame").sandbox;
The result of x will be:
allow-scripts
Try it Yourself »
Definition and Usage
The sandbox property returns the value of the sandbox attribute in an iframe element.
The sandbox attribute is used to enable security restrictions for iframes with untrusted content (such as scripts and forms).
If specified as an empty string (sandbox=""), the sandbox attribute enables a set of extra restrictions for the content in the inline frame.
The value of the sandbox attribute can either be an empty string (all the restrictions is applied), or a space-separated list of pre-defined values that will REMOVE particular restrictions.
Note: This property is read-only.
Browser Support
Property | |||||
---|---|---|---|---|---|
sandbox | Yes | 10.0 | Yes | Yes | Yes |
Syntax
iframeObject.sandbox
Technical Details
Return Value: | A String, representing the value of the sandbox attribute |
---|
Related Pages
HTML reference: HTML <iframe> sandbox attribute
IFrame Object