[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

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
0
biglarrrr
Asked:
biglarrrr
  • 6
  • 3
  • 2
  • +1
1 Solution
 
Pravin AsarCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 AsarCommented:
>> 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
 
biglarrrrAuthor Commented:
This is perfect!!!! Thank you so much. :)

Thanks,
biglarrrr
0
 
ZvonkoSystems architectCommented:
You are welcome.
0
 
Pravin AsarCommented:
Sorry for typo..

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

does not matter the points..

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now