|
Posted by John Dunlop on 07/01/06 19:10
mayla_i@hotmail.com:
> Is there a difference between clicking on the refresh button in the
> browser and writing this command: "window.location.reload()"
Could be. At the HTTP level the relevant difference is between a
conditional and an unconditional GET. What a browser's Refresh
function does and what window.location.reload() does depends on the
browser and its implementation of the scripting language, neither of
which is on-topic here. I would guess window.location.reload(true)
would generally produce an unconditional GET.
> (in the meaning of loading images on a page)
>
> The problem that I'm facing is as following:
> my page uses an image to display, I wrote a code in php to change some
> pixels of that image and save it with the same name, now I need to
> redownload this image again in my page so I wrote the statment
> "window.location.reload()" but it surprised me that the result dosen't
> appear unless I clicked mannually on the "refresh" button.
> It seems that the old image is preloaded in cache or such thing? and
> it's reloading again and again?
Sounds right.
> I tried to use the meta tag "no-cache" but with no good!
Cache directives in METAs, if they're taken into account at all,
affect the document itself, not any images (or other resources)
referred to in that document. You would normally specify cache
directives for images in their own HTTP response headers.
If you have an image which changes either regularly or frequently,
and it remains conceptually the same image, you would keep it on a
tight reign, that is, specify short expiration times. That way, when
it does change, browsers re-request it rather than pull it from caches.
If, on the other hand, it is conceptually a different image, I would
rename it (you would then have to keep the document that references the
image on a tight reign).
Mark Nottingham's tutorialish page is the recommended reading.
--
Jock
[Back to original message]
|