THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

IFrame sandbox Property

Frame/IFrame Object Reference IFrame Object

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

Internet Explorer Firefox Opera Google Chrome Safari

The sandbox property is supported in all major browsers.

Note: The sandbox property is not supported in IE 9 and earlier versions, or in Opera 12 and earlier versions.


Syntax

iframeObject.sandbox

Technical Details

Return Value: A String, representing the value of the sandbox attribute

Related Pages

HTML reference: HTML <iframe> sandbox attribute


Frame/IFrame Object Reference IFrame Object