Open In App

HTML | DOM IFrame sandbox Property

The IFrame sandbox Property in HTML DOM is used for returning the value of the sandbox attribute in an iframe element. When the sandbox attribute exists, and it will:

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. Syntax: 



iframeObject.sandbox

Return Value: It returns string Value Which representing the value of the sandbox attribute. 

Example: 






<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM iframe sandbox Property
    </title>
</head>
 
<body style="text-align:center;">
 
    <h1>GeeksforGeeks</h1>
 
    <h2>
        HTML DOM iframe sandbox Property
    </h2>
 
            id="GFG"
            height="200"
            width="400"
            sandbox="allow-scripts">
    </iframe>
 
    <br>
    <br>
 
    <button onclick="Geeks()">
        Submit
    </button>
    <p id="sudo"></p>
    <script>
        function Geeks() {
            var iframeID = document.getElementById("GFG").sandbox;
            document.getElementById("sudo").innerHTML = iframeID;
        }
    </script>
</body>
 
</html>

 

 

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


Article Tags :