By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,117 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,117 IT Pros & Developers. It's quick & easy.

Preloading subsequent HTML pages

P: n/a

I have a common company web site with the home page, products,
services, about us and contact pages. I'd like to preload the 4 other
pages in the background when I access a page to make the site faster.
I already preload images properly. I thought about using a 1x1px
iframe but it's not very nice. So I tried considering .html pages as
if they were image files and I tried this code:

var preload=new Image();

But this code doesn't preload the products.html page. It seems the
Image() object only handles images, as the name implies, eh eh...
How would you preload subsequent pages?
Jan 27 '08 #1
Share this Question
Share on Google+
5 Replies

P: n/a
On Jan 27, 7:12*am, Thomas 'PointedEars' Lahn <>
With prefetching, which does not require scripting.
Thanks. Yeah, the only problem is that basically only Mozilla browsers
support it:

Any other suggestion in the meantime? I was thinking about using an
Ajax function after loading the initial page and using the GET method
to push subsequest pages. Would this work?
Jan 27 '08 #2

P: n/a
On Jan 27, 11:33*am, Charles <landema...@gmail.comwrote:
With prefetching, which does not require scripting.
I tried it in Firefox, but it didn't keep the page in cache. I tried
the Ajax way and it works in FF and IE, but not in Opera:

I'm gonna get in touch with the Opera team to find out why.
Jan 27 '08 #3

P: n/a
I tried both synchronous and asynchronous modes. Here are my findings:

1. In synchronous mode, I'm able to prefetch subsequent pages but the
browser freezes for a few seconds, it's not an ideal situation. It
happens with all browsers I've tested. Here's an example that
prefetches pages in synchronous mode:
and here's the line that I use:"GET",pages[i],true);

2. In asynchronous mode, I'm unable to fetch pages, it seems the loop
is executed right away without fetching anything. I don't understand
very well what happens behind the scene. But at least the browser
doesn't freeze! Here's an example that uses asynchronous mode: and that
doesn't work. Here's the line that I use:"GET",pages[i],false);

What do you think I can do to prefetch pages in asynchronous mode?
Jan 27 '08 #4

P: n/a
Oh, actually I swapped the two URLs.
Jan 27 '08 #5

P: n/a
On Jan 27, 8:37*pm, Thomas 'PointedEars' Lahn <>
Please search the newsgroup for suggestions on how to perform several
asynchronous XHRs.
I think you'll be happy to see what I've come up with. I'm now able to
prefetch pages using Javascript in asynchronous mode. Please have a
Feb 3 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.