473,756 Members | 4,165 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 7194
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.j pg" 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.jp g";
</script>
</head>
<body onload="documen t.images['placeHolder'].src = 'myHugeImage.jp g';">
<img name="placeHold er" src="someSmallI mage.jpg">
</body>

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

--
| Grant Wagner <gw*****@agrico reunited.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
2619
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 downloaded for the slideshow, I resize them with a PHP script
4
1424
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 only stoped pages from being cached but not images:
1
2107
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 caching problem the scripting seems to work Any help welcomed:
1
1583
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
2126
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 definitely not the browser that's caching the files - IIS is actually serving the wrong file.
4
2694
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
1797
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 ways to say catch these types? such as GIF, JS,JPG, and PNG only? I have IIS 6 and ASP.NET 2.0...
1
2234
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 unwanted items. The JPG previews of the webpage are rendered in several sizes: iconic, mid-sized 600px...
0
14803
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 web server which then usually is answering with a "304 Not modified" as can be seen in his access...
0
10069
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9884
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8736
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.