Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | <iframe> sandbox Attribute

  • Last Updated : 03 Sep, 2021

The sandbox attribute permits an additional set of restrictions for the content within the iframe.
When the sandbox attribute exists, and it will: 

  • treat the content as being from a singular origin
  • It blocks form submission
  • It blocks script execution
  • It disables APIs
  • It also preventing links from targeting other browsing contexts
  • It stop the content to navigate its top-level browsing context
  • block automatically triggered features (such as automatically playing a video or automatically focusing a form control)

The value of the sandbox attribute will either be simply sandboxed (then all restrictions are applied) or a space-separated list of pre-defined values which will take away the actual restrictions.

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.


<iframe sandbox="value">

Attribute Values 

  • no-values: applies all restriction
  • allow-forms: Re-enables form submission
  • allow-pointer-lock: Re-enables APIs
  • allow-popups: Re-enables popups
  • allow-same-origin: It allows the content of iframe to be treated as being from same origin
  • allow-scripts: Re-enables scripts
  • allow-top-navigation: It Allows the content of iframe to navigate its top-level browsing context



<!DOCTYPE html>
        HTML Iframe sandbox Attribute
    <h2>HTML IFrame sandbox Attribute</h2>
    <iframe id="GFGFrame"


Supported Browsers:The browsers supported by HTML IFrame sandbox Attribute are listed below 

  • Google Chrome 4.0
  • Firefox 4.0
  • Apple Safari 4.0
  • Opera 10.5
  • Edge


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!