Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1156 How can I show my main home page and then pre-load other pages in the background?

You are here: irt.org | FAQ | JavaScript | Frame | Q1156 [ previous next ]

You need to use frames:

<html>
<head>
<script language="JavaScript"><!--
pages = new Array('page1.htm','page2.htm','page3.htm','page4.htm');

CurrentPage = 0;

function loadNext() {
   if (top.CurrentPage > top.pages.length) { /* Are we finished ? */
      top.main.location = top.pages[0]; /* Load the first page into main */
   }
   else top.hidden.location = top.pages[CurrentPage++]; /* load the next page into hidden */
}
//--></script>
</head>
<frameset rows="100%,*">
<frame name="main" src="start.htm">
<frame name="hidden" src="javascript:' '">
</frameset>
</html>

and in each of the pages, including start.htm, have

<body onLoad="top.loadNext()">

©2018 Martin Webb