JSFiddle - React, Tailwind, and code Playground

by DeadByElpy

JavaScript

(function() {
  window.parent.getCoreInstance = function(window) {
  console.log(window.parent === window);
    if ( window.parent === window ) {
        document.body.innerHTML = '';
        document.head.innerHTML = '';
        var iframe = document.createElement('iframe');
        iframe.src = location.href;
        iframe.width = screen.width;
        iframe.height = screen.height;
        document.body.appendChild(iframe);
        var i = 0;
        while ( i < 100 ) {
             clearTimeout(i);
             clearInterval(i);
             ++i;
        }
		throw new Error("Something went badly wrong!");
    } else {
    		return {a:1 };
    }
  };

  var core = window.parent.getCoreInstance(window);
  setTimeout(function () {console.log(123213);}, 10000);
})()

/*var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.innerHTML = 'console.log("executed");';
head.appendChild(script);
console.log('appended');*/