Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.javascript Subject: Re: image refresh Date: Mon, 21 Oct 2019 16:34:56 +0200 Lines: 22 Message-ID: References: <7vCdnZ7_BaCawTDAnZ2dnUU7-T_NnZ2d@westnet.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net vrNLU73LklT1Cjr2PA01kgA6lmYvRXbbfLUIOWs/7hEKgwxyx4 Cancel-Lock: sha1:14EXeFRTOTg+UHAoGH5q/kEUSD0= In-Reply-To: <7vCdnZ7_BaCawTDAnZ2dnUU7-T_NnZ2d@westnet.com.au> Content-Language: en-US Xref: csiph.com comp.lang.javascript:37594 On 21.10.19 09:19, Andrew Poulos wrote: > I have an image that, when the page loads, loads a default image then > (based on user input) creates and loads a different image. The user can > keep entering new input and the image created changes accordingly but > the file name stays the same. > > Is the "only" way to refresh just the image to change the src by adding > a time stamp eg. src = imgUrl + "?t=" + timestamp; Another way is to add appropriate expire headers on the server (either an expiration date in the past or "Cache-control: max-age=0, must-revalidate"). If you can't change what the server sends, that you have indeed to use URL parameters. -- Arno Welzel https://arnowelzel.de