X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <iframe> sandbox Attribute

HTML iframe Tag Reference HTML <iframe> tag

Example

An <iframe> with extra restrictions:

<iframe src="demo_iframe_sandbox.htm" sandbox=""></iframe>

Try it yourself »

More "Try it Yourself" examples below.

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The sandbox attribute is supported in all major browsers.

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


Definition and Usage

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.


Differences Between HTML 4.01 and HTML5

The sandbox attribute is new in HTML5.


Syntax

<iframe sandbox="value">

Attribute Values

Value Description
"" Applies all restrictions below
allow-same-origin Allows the iframe content to be treated as being from the same origin as the containing document
allow-top-navigation Allows the iframe content to navigate (load) content from the containing document
allow-forms Allows form submission
allow-scripts Allows script execution


Examples

Try it Yourself - Examples

An <iframe> sandbox allowing form submission
Enable a set of extra restrictions, but allow form submission.

An <iframe> sandbox allowing scripts and access to server content
Enable a set of extra restrictions, but allow scripts and access to server content.


HTML iframe Tag Reference HTML <iframe> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook