473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Preloading subsequent HTML pages

Hello,

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();
preload.src="products.html";

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?
Thanks,
Jan 27 '08 #1
5 2163
On Jan 27, 7:12*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
With prefetching, which does not require scripting.
Thanks. Yeah, the only problem is that basically only Mozilla browsers
support it: http://en.wikipedia.org/wiki/Link_prefetching

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?
Thanks.
Jan 27 '08 #2
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:
http://jsite.dreamhosters.com/preload/

I'm gonna get in touch with the Opera team to find out why.
Jan 27 '08 #3
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: http://jsite.dreamhosters.com/preloa...nchronous.html
and here's the line that I use: xmlHttp.open("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:
http://jsite.dreamhosters.com/preloa...nchronous.html and that
doesn't work. Here's the line that I use:
xmlHttp.open("GET",pages[i],false);

What do you think I can do to prefetch pages in asynchronous mode?
Thanks.
Jan 27 '08 #4
Oh, actually I swapped the two URLs.
Jan 27 '08 #5
On Jan 27, 8:37*pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
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
look: http://preload-pages-with-javascript.dreamhosters.com/
Cheers.
Feb 3 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Fabian | last post by:
var preload1 = new Image(); preload1.src = "/pic/yay.gif"; var preload2 = new Image(); preload2.src = "/pic/nay.gif"; The above is meant to preload image files, yes? Problem is, it doesnt seem...
2
by: Stevio | last post by:
In my web page I preload images so that when a user clicks on a part of the image, the image changes. The images are used to display 4 tabs. Each image shows a different tab as highlighted. If a...
4
by: Dennis Allen | last post by:
Hi. I have one image that has to show up in a html page several times. To save time, I'd like to preload this image. As an example: if (document.images) { tester = new Image()...
5
by: Andrew Poulos | last post by:
Is there a standards compliant way to preload non-streaming audio (in HTML 4 Strict)? I did a search and all that I could find was to use the EMBED tag which is inappropriate. Andrew Poulos
40
by: Geoff Cox | last post by:
Hello, I am still having problems - apologies if the answer is in previous postings! I now have, in the header, <sctipt> var myimages=new Array();
10
by: Hemant Shah | last post by:
Folks, I am using DB2 UDB 8.1 on RedHat ES 2.1. In order to improve performance of one of our table, I would like to preload some or all of the data into memory when I start DB2. Is there a...
2
by: sachaburnett | last post by:
Hi everyone! I'm new to Javascript and am finding so much useful information on this group, so thanks to you all! I have a question about preloading images for onmouseover/out effects and...
7
by: Keith Hughitt | last post by:
Hi all, I am having trouble preloading images in a javascript application, and was wondering if anyone had any suggestions. Basically I have a bunch of images stored in a database as BLOBs. At...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.