IFrame sandbox attribute

Definition and Usage

sandbox The attribute returns sandbox attribute value.

The sandbox attribute is used to enable security restrictions for iframes containing untrusted content (such as scripts and forms).

If specified as an empty string (sandbox=""), the sandbox attribute enables a set of additional restrictions for the content within the iframe.

The value of the sandbox attribute can be an empty string (implement all restrictions), or a space-separated list of predefined values, which will remove specific restrictions.

Note:This attribute is read-only.

Example

Return the value of the sandbox attribute:

var x = document.getElementById("myFrame").sandbox;

Try It Yourself

Syntax

iframeObject.sandbox

Technical Details

Return Value: A string value representing the value of the sandbox attribute.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
4.0 10.0 17.0 5.0 15.0

Related Pages

HTML Reference Manual:HTML <iframe> sandbox Attribute