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

Qu about pre cached images

P: n/a
Hi.

I read an article on the web about pre caching images with javascript.

I'm doing it kind of like so:

var myImage = new Image();
myImage.src = "location/image.jpg";
I put that code into a .js file called mySite.js

Given that every page on the site has the following in the line:

<head><script LANGUAGE="JAVASCRIPT" SRC="mySite.js"></head>

Does that mean I'm forcing people's browsers to reload the same image
every time they navigate to a new page on my site?
Sep 21 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
VK

sleem wrote:
Given that every page on the site has the following in the line:

<head><script LANGUAGE="JAVASCRIPT" SRC="mySite.js"></head>

Does that mean I'm forcing people's browsers to reload the same image
every time they navigate to a new page on my site?
No, mySite.js file is loaded only once (for the first page) and then
reused from cache.
Same with pictures: each separate picture is loaded only once and then
reused from the cache.

Note: that is for "real" .gif / .jpg / .png images. That could be some
implications if pictures are coming from an image-generating server
script and some headers are set in certain ways.

Sep 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.