HTML Automatic Image Refresh

L

Liam Gibbs

I'm having a tough time getting the answer for this. My HTML is lent
out. I don't need my HTML book for a year; I lend it out, and four
days later, whaddayaknow, I need it again. So I'm relegated to the
web, and Google isn't even helping out.

Anyway, what I'm trying to do is reload an image not from the cache
but from the server every time the page is reloaded. The reason is the
image may have changed; it's not a simple, constant image file. I know
the server will grab it from the server when you refresh (F5, the
refresh button, etc.), but I mean every time.

I've tried <META NAME = "EXPIRES" CONTENT = "0">, and this doesn't
seem to do the job. Maybe it only works on HTML content, not images.
I'm new to meta tags, but as I understand, this will tell the browser
to use content from the server rather than the cache (as in the page
expires immediately). It's not working.

Is there a way of doing what I need with all browsers? Seems unlikely,
but stranger things have happened.

Am I explaining this properly? Not so sure, but I hope this helps to
explain what I need. Every link I get from Google, I end up seeing
content about how to make the page automatically refresh after x
seconds, which is not what I want. This is probably partly because I
don't exactly what search words to use....
 
O

Oli Filth

Liam said:
I'm having a tough time getting the answer for this. My HTML is lent
out. I don't need my HTML book for a year; I lend it out, and four
days later, whaddayaknow, I need it again. So I'm relegated to the
web, and Google isn't even helping out.

Anyway, what I'm trying to do is reload an image not from the cache
but from the server every time the page is reloaded. The reason is the
image may have changed; it's not a simple, constant image file. I know
the server will grab it from the server when you refresh (F5, the
refresh button, etc.), but I mean every time.

I've tried <META NAME = "EXPIRES" CONTENT = "0">, and this doesn't
seem to do the job. Maybe it only works on HTML content, not images.
I'm new to meta tags, but as I understand, this will tell the browser
to use content from the server rather than the cache (as in the page
expires immediately). It's not working.

<META> tags only apply to the HTML content, and even then they're not
100% reliable. To achieve what you want, you must configure your server
to send image files with particular HTTP headers that specify the cache
time. e.g. with Apache, you can specify:

ExpiresActive On
ExpiresByType image/gif A0

in your .htaccess or httpd.conf, and there are various other directives
that are needed as well (someone else will probably be able to give you
more info, I haven't played around with Apache settings much).

If the image is dynamically generated by PHP, you can specify:

session_cache_limiter("nocache");

at the start of the PHP script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top