Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Document Object</h1>
<h2>The adoptNode() Method</h2>
<iframe id="myFrame" src="/default.asp" style="height:380px;width:520px;"></iframe>
<p>Click "Try it" to adopt the first H1 element in the iframe.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
  const frame = document.getElementById("myFrame");
  const h1 = frame.contentWindow.document.getElementsByTagName("H1")[0];
  const node = document.adoptNode(h1);
  document.body.appendChild(node);
}
</script>
</body>
</html>