Solved

Non caching image

Posted on 1998-04-22
13
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
13 Comments
 
LVL 12

Expert Comment

by:Otta
ID: 1853965
It cannot be done.

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

Author Comment

by:faur
ID: 1853966
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
ID: 1853967
I think Otta is right, unless you can explicitly set the content expiration via the HTTP header that gets the image.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 12

Accepted Solution

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

Expert Comment

by:julio011597
ID: 1853969
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
ID: 1853970
> ... 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
 
LVL 5

Expert Comment

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

Expert Comment

by:Otta
ID: 1853972
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
ID: 1853973
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
ID: 1853974
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
ID: 1853975
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
ID: 1853976
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
ID: 1853977
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

724 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