JSFiddle - React, Tailwind, and code Playground
by krasimir
HTML
<a href="javascript:void(0);" id="button">click me</a>
CSS
body, html {
width: 100%;
height: 100%;
position: relative;
}
JavaScript
var button = document.getElementById("button");
button.addEventListener("click", function() {
var frame = document.createElement("IFRAME");
var body = document.querySelector("body");
var width = 300;
var height = 200;
frame.setAttribute("src", "http://www.w3schools.com/tags/tag_iframe.asp");
frame.setAttribute("style", "position: absolute; top: 50%; left: 50%; margin-left: -" + (width/2) + "px; margin-top: -" + (height/2) + "px");
body.appendChild(frame);
});