JSFiddle - React, Tailwind, and code Playground

HTML

<body>
<div class="div1">
stuff
</div>
<div class="div2">
<a href="https://jsfiddle.net/user/login/">link</a>
</div>
</body>

JavaScript

function embed(src, target){
	return new Promise(function(resolve, reject){
  	let iframe = document.createElement("iframe");
  			iframe.src = src;
        iframe.style = "width: -webkit-fill-available;height: -webkit-fill-available;";
      	iframe.onload = function(){
        	resolve(iframe.contentWindow.document);
        };

      target.parentNode.replaceChild(iframe, target);
  });
}

let href = document.querySelector('.div2 a').getAttribute("href"),
		target = document.querySelector('.div1');

embed(href, target).then(function(doc){

  console.log(doc.querySelector('h2'));

});