Refresh to a list of URLs

Hi, I hope someone can help me with this. I need to be able to open a single browser and go to a local html page. I need that html page to load a list of hard-coded URLs each for a specifed amount of time. For example... When I open that html page I'd like the first page to be, say, ESPN. Then, after say 30 seconds it needs to refresh to Google. 30 seconds later it needs to refresh to Yahoo. Etc., etc. I've already written a simple refresh function that is configurable:

function reFresh() {
  location.reload(true)
}
//milliseconds
window.setInterval("reFresh()",180000);

Now I just need to be able to tell it where to refresh to. The only thing is, these URLs will be loaded into an IFRAME (It's for a local computer so I'm not worried about hacking) and that IFRAME is what needs to be refreshed with the new URL.

Thanks,
biglarrrr
biglarrrrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pravin AsarPrincipal Systems EngineerCommented:
Here are the set of files (autoLoader.htm, mypage.htm which has a iframe element);




<html>
<head>
<title>AutoLoader Document</title>
</head>

<body onLoad="openWindow();">
<script language="javascript">
function reFresh() {
      childWindow.document.iframe1.location.href = urlList[ux];
      ux++;
      if (ux > urlList.length) { ux=0; }
}

var childWindow = null;
var urlList = new Array();
var ux=0;
urlList[ux++] = "http://www.yahoo.com";
urlList[ux++] = "http://www.sun.com";
urlList[ux++] = "http://www.google.com";
ux =0;
function openWindow() {
      ux = 0; // Open the first url
      childWindow = window.open ("mypage.htm","cw", "toolbar=no, status=no");
      reFresh();
      //milliseconds
      window.setInterval("reFresh()",180000);
}

</script>
</body>
</html>


<!--- File mypage.htm -->

<html>
<head>
<title>MyPage Document</title>
</head>

<body>
<div>THIS IS MY PAGE</div>
<iframe name="iframe1" src="" width="400" height="400"></iframe>
</body>
</html>
0
biglarrrrAuthor Commented:
Thank you for replying. This is close but I have 1 index page which actually loads 3 iframes. 2 of the iframes just display 1 web page but the 3rd is the one which needs to load a list of URLs. I can't use a popup either. I basically have:
<TD><IFRAME name=iframe1...></IFRAME></TD>
<TD><IFRAME name=iframe2...></IFRAME></TD>
<TD><IFRAME name=iframe3...></IFRAME></TD>
The last one (iframe3) will be the one that loads from a list of URLs and will only load them based on a setInterval.

Thanks,
biglarrrr
0
biglarrrrAuthor Commented:
Also, the reason why we can't use a popup is because I HAVE to use IE and I need to run the browser in full screen mode. Well, as you may know, when you hit F11 on a popup you don't get a full screen, you actually see the address bar.

Thanks,
Larry
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

noamattdCommented:
I've had to do this exact same thing before; I did it by making an array of URLs and writing a cookie each time one of the urls was visited.  When it's time to get the next url, see if a cookie with that url exists.  If it does, try the next url in the array.
0
biglarrrrAuthor Commented:
Thanks noamattd but how do I go about doing that?

Thanks
0
Pravin AsarPrincipal Systems EngineerCommented:
>> I need to be able to open a single browser and go to a local html pag

I thought you want to have a pop-up window.

Certainly it is possible to do.

In such case we need to update the reFresh() function to refer a frame in the current page..



function reFresh() {
      //
      top.frame3.location.href = = urlList[ux];
     ux++;
     if (ux > urlList.length) { ux=0; }
}
0
biglarrrrAuthor Commented:
I'm confused. I updated the refresh function like you suggested and it's not working. This is what I currently have.

<HTML>
<HEAD>
<TITLE>test</TITLE>

<script language="javascript">
<!--
function reFresh() {
      //
      top.iframe1.location.href = = urlList[ux];
     ux++;
     if (ux > urlList.length) { ux=0; }
}
var childWindow = null;
var urlList = new Array();
var ux=0;
urlList[ux++] = "http://www.yahoo.com";
urlList[ux++] = "http://www.sun.com";
urlList[ux++] = "http://www.google.com";
ux =0;
//milliseconds
window.setInterval("reFresh()",180000);
}
</script>
</HEAD>
<BODY LINK="#0000FF" VLINK="#0000FF" ALINK="#0000FF" BGCOLOR="#000884">
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
      <TD height=930><iframe name="iframe1" source="" frameborder="0" width="770" height="100%" scrolling="no"marginwidth="0" marginheight="0"></iframe></TD>
      <TD valign=top><iframe name="iframe2" src="http://www.espn.com" frameborder="0" width="450" height="239" scrolling="no"marginwidth="0" marginheight="0"></iframe>
            <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
            <TR>
                  <TD><iframe name="iframe3" src="http://www.cnn.com" frameborder="0" width="450" height="450" scrolling="no"marginwidth="0" marginheight="0"></iframe></TD>
            </tr>
            </table>
      </td>
</TR>
</TABLE>
</BODY>
</HTML>

I think my brain just isn't working.

Thanks.
0
biglarrrrAuthor Commented:
Oops. top.iframe1.location.href = = urlList[ux]; should actually be using iframe3. But either way, I'm doing something wrong.
0
ZvonkoSystems architectCommented:
There is no such operator:   = =

Check this:
<HTML>
<HEAD>
<TITLE>test</TITLE>
<script language="javascript">
function reFresh() {
     window.frames.iframe3.location.href = urlList[ux++];
     if (ux >= urlList.length) { ux=0; }
}
var childWindow = null;
var ux=0;
var urlList = ["http://www.yahoo.com","http://www.sun.com","http://www.google.com"];
//milliseconds
window.setInterval(reFresh,2800);
</script>
</HEAD>
<BODY LINK="#0000FF" VLINK="#0000FF" ALINK="#0000FF" BGCOLOR="#000884">
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
     <TD height=930><iframe name="iframe1" source="" frameborder="0" width="770" height="100%" scrolling="no"marginwidth="0" marginheight="0"></iframe></TD>
     <TD valign=top><iframe name="iframe2" src="http://www.espn.com" frameborder="0" width="450" height="239" scrolling="no"marginwidth="0" marginheight="0"></iframe>
          <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
          <TR>
               <TD><iframe name="iframe3" src="http://www.msn.com" frameborder="0" width="450" height="450" scrolling="no"marginwidth="0" marginheight="0"></iframe></TD>
          </tr>
          </table>
     </td>
</TR>
</TABLE>
</BODY>
</HTML>

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
biglarrrrAuthor Commented:
This is perfect!!!! Thank you so much. :)

Thanks,
biglarrrr
0
ZvonkoSystems architectCommented:
You are welcome.
0
Pravin AsarPrincipal Systems EngineerCommented:
Sorry for typo..

Good to know  Zvonko  helped to solve the problem...

does not matter the points..

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.