Skip to content

Truly independent web browser

1.2 KB
Raw Blame
<!DOCTYPE html>
<html class="reftest-wait">
<style>
    iframe { display: block; width: 200px; height: 150px; border: 0; }
</style>
<iframe></iframe>
<script>
    const iframe = document.querySelector("iframe");
    iframe.srcdoc = `<!DOCTYPE html>
        <style>
            body { margin: 0; height: 1000px; background: white; }
            main { position: relative; z-index: 1; height: 600px; background: navy; }
            .stripe { position: absolute; left: 0; width: 200px; height: 30px; background: lime; }
            #nav { position: absolute; left: 20px; top: 125px; width: 100px; height: 40px; background: orange; mix-blend-mode: difference; }
        </style>
        <main>
            <div class="stripe" style="top: 120px"></div>
            <div class="stripe" style="top: 160px"></div>
            <div id="nav"></div>
        </main>`;
    const frame = () => new Promise(resolve => requestAnimationFrame(resolve));
    window.onload = async () => {
        await frame();
        await frame();
        iframe.contentWindow.scrollTo(0, 115);
        await frame();
        await frame();
        document.documentElement.classList.remove("reftest-wait");
    };
</script>