change iFrame src after x seconds + no return previous page

Discussion in 'Web Design and Development' started by paulz357, Feb 1, 2014.

  1. paulz357 macrumors newbie

    Joined:
    Feb 1, 2014
    #1
    Hello,
    Here is my code to change iframe src after x seconds.
    I need help to modify it so, when Page2 has loaded, user cannot return to Page1.

    Here is the code :

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>MyFile</title>
    <script type="text/javascript">
    var frames = Array('http://www.mydomain.com/files/Page1', 55,
    'http://www.mydomain.com/files/Page2');
    var i = 0, len = frames.length;
    function ChangeSrc()
    {
    document.getElementById('frame').src = frames[i++];
    if (i >= len) return; // no more changing
    setTimeout('ChangeSrc()', (frames[i++]*1000));
    }
    window.onload = ChangeSrc;
    </script>
    </head>
    <body>
    <iframe src="" name="frame" id="frame" width="100%"height="100%></iframe>
    </body>
    </html>
     
  2. Code cookies macrumors newbie

    Joined:
    Dec 23, 2011
    Location:
    UK
    #2
    Have you thought about having multiple iframes, and setting the css to
    and then using jquery show and hide?

    Let me know if you have any problems
     

Share This Page