Javascript DOM HTML IFrame seamless Property

Introduction

Find out if an <iframe> looks like it is a part of the containing document, no borders or scrollbars:

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

View in separate window

<!DOCTYPE html>
<html>
<body>
<iframe id="myFrame" src="https://www.java2s.com" sandbox="allow-scripts">
  <p>Your browser does not support iframes.</p>
</iframe>//from w ww  .ja  va2 s.  c  o  m
<button onclick="myFunction()">Test</button>

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

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

</body>
</html>

This property mirrors the HTML seamless attribute.

Property Values

Value Description
true The iframe should look like it is a part of the containing document
falseDefault. The iframe should not look like it is a part of the containing document

The seamless property returns true if the iframe looks like it is a part of the containing document, otherwise it returns false.




PreviousNext

Related