0

I'm a real amateur when it comes to coding. I'm trying to embed a webpage into a dashboard, just using notepad to write the HTML, got some, but limited, coding experience. The webpage I'm embedding has fixed items down the page, and so far I've managed to get the page to jump down the page, stopping at each of these articles. Note the site I'm embedding is external - I don't own it. I've got this HTML code, which includes some javascript to make the iframe the correct size for the embedded page automatically.

<html lang="en">
<head>
<meta charset="utf-8">
<title>Dashboardtest</title>
<style>

    iframe{
        width: 49%;
        border: 4px solid #CB0F0F;
    }
</style>
</head>
<body onload="pageScroll()" bgcolor="33ACFF">
   <h1 style="font-family:Pacifico">Polls... the Results are In!</h1> <iframe src="https://yearbook.com/s/polls/" height="600px" id="myIframe"></iframe>

    <script>
    // Selecting the iframe element AUTO HEIGHT CODE
    var iframe = document.getElementById("myIframe");

    // Adjusting the iframe height onload event
    iframe.onload = function(){
        iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
    }
    </script>

</body>
</html>                              

Previously, I had this code:

<html>
<head>
<title>previousdashboardtest</title>
                                <meta http-equiv="refresh" content="10">


<script type="text/javascript">


<!--

function pageScroll() {


window.scrollBy(0,392);

scrolldelay = setTimeout('pageScroll()',1000); //Increase this # to slow down, decrease to speed up scrolling

        window.setInterval(function scrollWin(){
      /// call your function here
    }, 5000);

    }

//-->

</script>

</head>

<body onload="pageScroll()">


<iframe src="https://yearbook.com/s/polls/" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" width="100%" 
height="45000px" style="padding: 0; margin: 0; border: 0;"></iframe>

</div>

        <script>
        function scrollWin() {
        window.scrollTo(0, 0);
        }
        </script>

</body>
</html>

It scrolled down perfectly, stopping at each item down the page. But the whole window was scrolling, meaning that the other text I have on the page would scroll out of view. Hence I embedded the page as an iFrame, and just want to scroll the Iframe. Is this possible? Or do I need to try some other way. Ideally in the end I'd like it to scroll down to the bottom of the Iframe, and then loop back to the top indefinitely. Note: The page I'm embedding requires a login, so best to use some other page if testing.

Dom
  • 1
  • 1

0 Answers0