Bootlin logo

Elixir Cross Referencer

    <meta name="viewport" content="width=700">
        var originalViewportWidth;

        function checkViewportWidthAfterHistoryNavigation() {
            if (originalViewportWidth == window.innerWidth)
                document.body.innerHTML = "<div style='color:green'>PASS, viewport width is OK after history navigation.</div>";
                document.body.innerHTML = "<div style='color:red'>FAIL, viewport width is different after history navigation.</div>";

        function navigateAwayAndBack() {
            // Force layout before getting viewport width.
            originalViewportWidth = window.innerWidth;

            // Assigning to window.location does not create a history entry, so instead link click is simulated.
            var evt = document.createEvent("MouseEvents");
            evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
            // Initiate timer to do final verification as we have navigated back to the cached version of this page.
            // This test makes use of the behavior where timers are restored on a cached page.
            setTimeout('checkViewportWidthAfterHistoryNavigation()', 1000);

<body onload='setTimeout("navigateAwayAndBack()", 0 );'>
    <a id='anchor' href='data:text/html,
                <meta name="viewport" content="width=600">
            <body onload="document.body.offsetTop; history.back();"></body>