?
Solved

Non caching image

Posted on 1998-04-22
13
Medium Priority
?
233 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 12

Accepted Solution

by:
Otta earned 200 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

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

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

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video teaches users how to migrate an existing Wordpress website to a new domain.
Suggested Courses

752 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