I have a simple javascript that pans through webcam images. I does not update the images until one goes in and clears the cache, at that point the most recent images show up. Is there some code in javascript I can use to have this done or is there another method to achieve this?

Thanks
DS

Recommended Answers

All 5 Replies

This was fixed with html code.

Nevermind, thought it was fixed but the meta tags I was trying have not been successful beyond the first image. Any JS solutions to this?

The only valid solution to this problem of yours is to set proper response headers related to caching. For e.g. to make images uncacheable, serve them with a response header Expires: some past date . Google for caching headers.

Simply set an onbeforeunload event. One, you can give the user a chance to re-think the decision to leave the page by spawning a "yes/no" dialog box; and two, just having an onbeforeunload event will cause the browser to never cache the page: This means that the page will always be rendered exactly as if the user was hitting it for the very first time.
This should go inside the <head><!-- || --></head> tags'.

<script type="text/javascript">
<!-- BEGIN HIDING
window.onbeforeunload = function () {
 // This fucntion does nothing. It won't spawn a confirmation dialog
 // But it will ensure that the page is not cached by the browser.
}
// END HIDING -->
</script>

Thanks for the ideas. I am trying them out now. Its funny, everything is working fine in FF but IE7 not so much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.