473,513 Members | 3,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Caching Images

Hi all

Very new to JavaScript, I am trying to cache a number of images as the
page loads, is there a max number of images or memory usage before the
browser stops caching.

My PC has 1G ram so if it's a physical memory constraint then I think I am
away from that. I am trying to cache about 600K images, (this if for an
intranet so the page load time is fast) but I need the speed of cached
images for the page to work correctly. I seem to be able to only cache
about 400K.

Is this a limit or is there a trick I need to know.

Thanks DaveG
Jul 20 '05 #1
2 7161
APB
I suppose the limit depends on the browser's settings for the cached data (on disk).

I once created a page with 100 A4 scans. Needless to say the TaskManager reported a huge increase in IE's memory usage... and the
whole system blocked while trying to allocate more virtual memory.

If your on an Intranet, I guess caching too many images quickly outperforms loading them on-demand.

Alex.

--
__________________________________________________ _________
a p bertolini

"Se Dio è perfetto, perché ha creato le funzioni discontinue?"

#ICQ: 10681264
(www.webwarrior.org)

"Dave Griffiths" <da**@daveg.co.uk> ha scritto nel messaggio news:pa****************************@daveg.co.uk...
Hi all

Very new to JavaScript, I am trying to cache a number of images as the
page loads, is there a max number of images or memory usage before the
browser stops caching.

My PC has 1G ram so if it's a physical memory constraint then I think I am
away from that. I am trying to cache about 600K images, (this if for an
intranet so the page load time is fast) but I need the speed of cached
images for the page to work correctly. I seem to be able to only cache
about 400K.

Is this a limit or is there a trick I need to know.

Thanks DaveG

Jul 20 '05 #2
Dave Griffiths wrote:
Hi all

Very new to JavaScript, I am trying to cache a number of images as the
page loads, is there a max number of images or memory usage before the
browser stops caching.

My PC has 1G ram so if it's a physical memory constraint then I think I am
away from that. I am trying to cache about 600K images, (this if for an
intranet so the page load time is fast) but I need the speed of cached
images for the page to work correctly. I seem to be able to only cache
about 400K.

Is this a limit or is there a trick I need to know.

Thanks DaveG


"Caching images" refers to storing the image in the browser's Temporary
Internet Files or Browser Cache storage area before it's needed, so when you
request it later, it loads quickly because it is already stored on the local
disk.

(new Image()).src = 'whatever.jpg';

is intended to store "whatever.jpg" on your local hard disk, that
functionality is managed entirely by the browser, based on the HTTP headers
sent with the image and the browser's own cache settings. Whether the browser
stores the image in RAM is entirely browser dependant but is also irrelevant
since it has no impact on what you are trying to do.

There are a few possibilities:

1) your HTTP server's settings are such that those extremely large images are
being sent to the browser with headers that indicate they should not be cached

2) your Temporary Internet Files or Browser Cache settings are so low that
there simply isn't enough available space to cache the images to disk

3) it's taking longer to download that 600Kb image then the time before you
use it. As a result, it appears to not be "cached" because it is still being
downloaded when it's being used. A simple example of this would be:

<head>
<script type="text/javascript">
// I'm so clever I'm caching myHugeImage
(new Image()).src = "myHugeImage.jpg";
</script>
</head>
<body onload="document.images['placeHolder'].src = 'myHugeImage.jpg';">
<img name="placeHolder" src="someSmallImage.jpg">
</body>

In the above code, it doesn't matter that you're being clever and pre-caching
"myHugeImage.jpg" because you're using it /long/ before it's had time to be
downloaded to the browser.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #3

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

Similar topics

6
2611
by: Mr WZ Boson | last post by:
Hello, I hope you can help - I'm a bit new to PHP. My basic problem is with a page (HTML) which is intended to display an image slideshow. On this page there are a number of links to click (one for each slideshow topic) and a "TV screen" to view the results. The images are stored on the server as (big) JPG files - and when they are...
4
1407
by: CLEAR-RCIC | last post by:
I want to write code to prevent IE from caching my pages at certain times. The following META tags prevent the page from caching but images still cache: <meta http-equiv="Cache-Control" content="no-cache"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="-1"> I tried do it with asp.net but also found this...
1
2087
by: Grunt | last post by:
Hi, I have been trying to put together a rotating banner. the code works but I am having a problem with the caching of the banner images. no matter what I try the page is constantly reloading the images, even worse they are not loading completely. This version includes a (vain) attempt at forcing the banner images to cache. Apart form the...
1
1543
by: vip001 | last post by:
Hello This is the site developed for one of my client 'Direct2deal.com' (http://www.direct2deal.com) This site has lots of images and hence downloading time of home page i much more..Is there a way , where i can cache these images i javascript????? Your suggestions will be highly appreciate
8
2091
by: Nick Gilbert | last post by:
Hi, Our development web server (Win 2003 Server) seems to be caching the output of various files (CSS and .aspx files) if they have no query string. The moment you put a question mark in the URL, it's fine. The problem is that if you modify a file, it still shows you the old file unless you restart the website or IIS itself. It's...
4
2682
by: Jake | last post by:
Does cookieless session state (with the sessionid embedded into the url) interfere with the browser's retrieval of cached images from one session to the next? Does the sessionid embedded into the url effectively limit client-side image caching to the lifetime of the session? Thanks Jake
1
1788
by: Smokey Grindle | last post by:
is there a way to cache only Javascript and images on the client? it seems that we are spending most of our time pushing out images and java scripts, but these never change! so whats the point of loading the same image on every page? evne though the page content may change the actual image and scripts dont... is there any performance tips or...
1
2228
by: | last post by:
I've built an application that scrapes JPG images of webpages and PDF instances of those webpages automatically from an RSS feed. References to the scraped resources are persisted to our database. I've also built an administrative interface that allows someone to scroll through a datalist of the JPG images of the page and to delete the...
0
14744
docdiesel
by: docdiesel | last post by:
The fastest (and cheapest) transfer of data is that which doesn't have to be done - because the data is already there. Or still there - the caching of files is widely known and practised. Each web browser is caching the files he formerly requested from the web server. But if the file is to be loaded a second time, still a request is sent to the...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7559
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5701
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.