HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 9th, 2000, 10:56 AM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
Is there anyway to keep someone's browser from caching an image... only? I know how to have it not cache the page, but I want only one image to be non-cached.

Any ideas?

Reply With Quote
  #2  
Old August 9th, 2000, 11:23 AM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I've never actually tried this, but I should imagine that it _may_ be possible through the use of a server module (e.g. a mod_perl module). As each item on the page is retrieved in a distinct GET request, it should be possible to return a different HTTP response header set for each request, meaning you could send back a no-cache pragma or expires value that is different for your particular image than the rest of the page. Problem is, capturing that particular GET request -- you may have to write a module to jump in at the URI translation stage and flag a special handler for the particular images you're concerned with.

I'll assume you're using Apache and know Perl , and will therefore be delighted to get to use mod_perl to try to do this. ;-) Go to http://perl.apache.org and have a dig through the mailing list archives. There's also an excellent mod_perl guide at http://perl.apache.org/guide, and if you don't find your answer there you can always subscribe to the list and pose a question -- a number of 'leading lights' in the mod_perl community are there to help out.

If you're not using Apache take a look at your server docs and see if you can write modules to get inside and play around with all the important bits.

Oh, and good luck. And be sure to post about any success you have -- I'd be quite interested in having some kind of reusable module to do that stuff. Perhaps something that took a list of images from a file or DB and prevented caching on them...

[This message has been edited by christucker2 (edited August 09, 2000).]

Reply With Quote
  #3  
Old August 9th, 2000, 03:35 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
I know how to use mod_perl/Apache/*nix server and perl. I wasn't looking for something like that though :P. I'm just want a tag to stick in the HTML... if there isn't one, I don't care.

Reply With Quote
  #4  
Old August 10th, 2000, 04:07 AM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Heh, there isn't one. But go on. You _know_ you really want to develop that module. Don't you? Come on.... ;-)

Reply With Quote
  #5  
Old September 14th, 2000, 09:51 PM
briand briand is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: USA
Posts: 2 briand User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
To prevent someone from caching an image (or any other web resource), you need to set the appropriate http headers. This is not achieved by doing anything in the enclosing page, but instead is something that (usually) the web server has to do for you.

In apache, a simple way to set expiration times (say, to a month if it is long-term cacheable, or to 0 if it is not) is to use an .htaccess file containing an ExpiresActive and one or more ExpiresByType directives. See the apache docs for details.

------------------
WEB CACHING RESOURCES: http://www.web-caching.com/

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > no-cache


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway