IFrame sandbox Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:IFrame

Description

The sandbox property returns the sandbox attribute in an iframe element.

This property is read-only.

Return Value

A String, representing the value of the sandbox attribute

The following code shows how to return the value of the sandbox attribute:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<iframe id="myFrame" src="http://java2s.com" sandbox="allow-scripts">
  <p>Your browser does not support iframes.</p>
</iframe>//ww w .j a va2 s.c o  m

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myFrame").sandbox;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials