Solved

Non caching image

Posted on 1998-04-22
13
199 Views
Last Modified: 2013-12-25
I'm trying to make a HTML page with an image that won't be cached. I need only need the image to be non-cached, not the entire page.

Thanks.
0
Comment
Question by:faur
13 Comments
 
LVL 12

Expert Comment

by:Otta
Comment Utility
It cannot be done.

The user's browser controls the caching,
and you cannot override it.
0
 

Author Comment

by:faur
Comment Utility
Otta, if your answer is "cannot be done", please comment the question, do not answer it.
That way, other people (who might have other suggestions than "cannit be done") can answer it.

Thanks anyway.
0
 
LVL 3

Expert Comment

by:percyn
Comment Utility
I think Otta is right, unless you can explicitly set the content expiration via the HTTP header that gets the image.
0
 
LVL 12

Accepted Solution

by:
Otta earned 100 total points
Comment Utility
It can't be done.  That is the "correct" answer,
and the correct answer gets the "points".
0
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
An image outputted from a CGI is NOT cached, AFAIK.
Graphic counters wouldn't work otherwise:

<IMG SRC="counter.cgi">

Maybe this is a more appropriate answer to "i'm trying to make an HTML page with an image that won't be cached."

BTW, yes, this has to do with HTTP headers sent back.

faur, please keep in mind that, if you are going to both reject an expert's answer and add a comment AT THE SAME TIME, nobody but that expert will be notified of it... you should first reject, then add the comment - i.e. two separate steps.
0
 
LVL 12

Expert Comment

by:Otta
Comment Utility
> ... please keep in mind that,
> if you are going to both reject an expert's answer
> and add a comment AT THE SAME TIME, nobody but
> that expert will be notified of it...
> you should first reject, then add the comment
> - i.e. two separate steps.

This sounds like a "bug" in E-E, rather than a "feature".
Are you sure?  If so, please post this deficiency
as either a "bug-report" or a "request for enhancement".

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 5

Expert Comment

by:julio011597
Comment Utility
Yes, it's actually a recent bug, and they are already aware of it.
0
 
LVL 12

Expert Comment

by:Otta
Comment Utility
Maybe, there is a way, if you're sure that the user's
browser has JavaScript enabled.

For an example, see:

http://WWW.IntrigueMe.com/english/

which displays a "count-down" (DD:HH:MM)
until the contest ends.

Of course, if the user's browser does NOT
support JavaScript, or if the user has
disabled it, or if the user has disabled
the auto-loading of images,
then the answer still is "it cannot be done".
0
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
In that case, Javascript just loads a bunch of Images to show the right digits; the images themselves will be loaded from cache if you've already seen them once - at least on Netscape, since someone told IE overrides cache in case of Javascript image loading, but i've not verified it and would not trust it very much.
0
 
LVL 12

Expert Comment

by:Otta
Comment Utility
Yes, JULIO, the images *could* be loaded from the cache.
However, since the JavaScript program is still "running",
the screen "updates" every minute.
So, in the string 'DD:HH:MM', certainly the image
for the 'DD' will be retrieved from cache,
but the newly-updated 'MM' value will need to be
downloaded across the network.
0
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
Sorry Otta, here is what i meant:

they have ten images, one for each digit; there names are d_ 0s.gif, d_1s.gif, d_2s.gif, ..., d_9s.gif.
Their Javascript code just loads the proper images on the proper time, BUT, if you've already seen - say - d_0s.gif, then you'll keep getting it from cache each time it is redisplayed, even in 'MM', even while the script is "running".

There's no way in Javascript to prevent caching.

Now, if you don't mind, i'd suggest we give this thread back to its owner.
0
 
LVL 3

Expert Comment

by:bigelos
Comment Utility
faur,
Otta is right.  Can't be done.  Even if you set the page to expire early, it will still be cached--it just gets updated everytime the page is loaded.

Maybe if you told us what you were trying to accomplish, we could help you better by providing an alternative method.
0
 
LVL 12

Expert Comment

by:Otta
Comment Utility
OTTA wrote:
> So, in the string 'DD:HH:MM', certainly the image
> for the 'DD' will be retrieved from cache,
> but the newly-updated 'MM' value will need to be
> downloaded across the network.

JULIO wrote:
> they have ten images, one for each digit;
> there names are d_ 0s.gif, d_1s.gif, d_2s.gif, ..., d_9s.gif.
> Their Javascript code just loads the proper images
> on the proper time,
> BUT, if you've already seen - say - d_0s.gif,
> then you'll keep getting it from cache
> each time it is redisplayed,
> even in 'MM', even while the script is "running".

I think that we have a "heated-agreement".  :-)
There's no difference in the two statements.

However, "extend" the concept beyond the actual code
used on the 'INTRIGUEME' web-site, and conceptualize
the "technique" used by the Java code.  This "trick"
causes images to be "pulled" from the web-server
on an "just-in-time" basis.

Of course, once the browser has retrieved any image,
it must be "cached", because the user can either
"resize" or "move" or "scroll" the browser-window, at any time.
Imagine the "processing-overheads" if such a user-action
were to force the web-browser software to download
a "fresh" copy of the text & images!  Prohibitive, correct?

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now