<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Loading Page Sample</title>
</head>
<body>
<div class="loading-page">
    <style>
        /* styles for loading page */
        html, body {
            background-color: #f5f5f5;
            width: 100%;
            height : 100%;
            overflow: hidden;
            position: relative;;
            box-sizing: border-box;
            font-family:Helvetica,Arial,sans-serif;
            color: #272727;
        }
        .loading-page {
            position: absolute;
            width: 500px;
            height: 300px;
            padding: 0;

            top: 50%;
            left: 50%;

            text-align: center;

            margin: -150px 0 0 -250px;
        }
        .loading-page h1, .loading-page h2 {
            margin: 0;
            padding:0;
            font-weight: 300;
            line-height: 30px;
            color: #272727;
        }
        .loading-page h1{
            font-size: 30px;
            margin-bottom:20px;
        }
        .loading-page h2 {
            font-size: 20px;
        }

    </style>
    <h1>Sample App</h1>
    <h2>Glorious things are waiting for you. We're just getting them ready...</h2>
    <script>
        !function(){function e(){this.element=function(e){return e(i.contentWindow.document.querySelector(".loading-page")),this}.bind(this),this.doneLoading=function(){delete window.loadingPage,this.element(function(e){e.classList.add("fade-out")}),setTimeout(function(){document.body.removeChild(i),document.body.classList.add("loaded")},250)}}var t=document.querySelector(".loading-page script");t.parentNode.removeChild(t);var n=document.querySelector(".loading-page"),o='<!DOCTYPE html><html lang="en"><head>    <meta charset="utf-8">    <meta http-equiv="X-UA-Compatible" content="IE=Edge">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <style>        @keyframes loadingPageFadeOut {            0% {                opacity: 1;            }            100% {                opacity: 0;            }        }        .loading-page.fade-out {            animation-name: loadingPageFadeOut;            animation-duration: .25s;            transition-timing-function: ease-out;            opacity: 0;            animation-fill-mode: both;        }    </style></head><body>{{iframe-inner-html}}</body></html>';o=o.replace("{{iframe-inner-html}}",n.outerHTML);var i=document.createElement("iframe");i.setAttribute("style","position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"),document.body.appendChild(i),i.contentWindow.document.open(),i.contentWindow.document.write(o),i.contentWindow.document.close(),n.parentNode.removeChild(n),window.loadingPage=new e}();

    </script>
</div>

<script>
    // pretending to load my app scripts, data, and build the DOM
    setTimeout(function(){
        var el = document.createElement('h1');
        el.innerHTML = 'Hello from My App';
        document.body.appendChild(el);
        window.loadingPage.doneLoading();
    }, 1000)
</script>
</body>
</html>