Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to auto refresh cycle multiple website page under one browser window like screen saver?

How to refresh cycle multiple website page under one browser ?

eg. I have several internal custom design website that I'd like to display in the large LCD panel for my user, kind of screensaver like but this is cycling through several web URL in full screen windows (F11)

like image 525
Senior Systems Engineer Avatar asked Dec 06 '22 00:12

Senior Systems Engineer


2 Answers

I agree with SLaks. You can use an iframe to load sites into your page and control which pages you show. You won't be able to control anything inside of the iframe but you will be able to show it. Also be careful of sites that will bust out of the iframe like stackoverflow.com

Here is an example that I built that I thought would be helpful in illustrating how this can be done. There is lots more that could be added to this to make it really cool, or it can be keept really simple.

Example page => http://mikegrace.s3.amazonaws.com/forums/stack-overflow/example-show-multiple-pages-like-screensaver.html

<html>
<head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  <script type="text/javascript" charset="utf-8">
    var sites = [
      "http://www.thinkgeek.com/",
      "http://www.artzstudio.com/2009/04/jquery-performance-rules/",
      "http://www.example.com"
    ];
    var currentSite = sites.length;

    $(document).ready(function () {
      var $iframe = $("iframe").attr("src","http://www.google.com");
      setInterval(function() {
        (currentSite == 0) ? currentSite = sites.length - 1 : currentSite = currentSite -1;
        $iframe.attr("src",sites[currentSite]);
      }, 7000);
    });
  </script>  
  <style type="text/css" media="screen">
    iframe {
      height: 100%;
      width: 100%;
      border: none;
    }
  </style>
</head>
<body>
  <iframe></iframe>
</body>
</html>
like image 95
Mike Grace Avatar answered Dec 07 '22 13:12

Mike Grace


You can make an <iframe> tag, then use Javascript to set its src in a setInterval callback.

like image 39
SLaks Avatar answered Dec 07 '22 14:12

SLaks