Solved

Image updated on website, how to trigger content change on client browsers

Posted on 2014-04-30
4
205 Views
Last Modified: 2014-05-06
I updated images on a website, but some of images still show old images. How can I trigger so that client browsers get all updated images when they visit next time?
0
Comment
Question by:crcsupport
  • 2
4 Comments
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 250 total points
ID: 40032946
the easiest way prevent image caching is to assign a random querystring to the src link:

<img src="myFile.png?a=12345" />
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40032948
the value of a can be a random number or a timestamp or any other random generated chars
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 40033224
There is no guaranteed way to do that.  Some people set their browser cache to 20 days which means that they may not check for new files for 20 days after the last time they checked.  When I want people to see new things on a page, I change the file names and save a new copy of the page to the server.  That let's the browser know that the main page has changed and the new file names won't be found in the browser cache.  Note that images, CSS files, and javascript files are cached Separately from the main page.  Changing the file names is the easiest way to make sure they are updated in the main page.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS style formatting? 2 35
Local HTML file to display local Access MDB data in browser 4 61
Navigation Menu Does Not Show on iPad 4 32
Change how page is organized 3 37
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

733 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