Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #37590 > unrolled thread

image refresh

Started byAndrew Poulos <ap_prog@hotmail.com>
First post2019-10-21 18:19 +1100
Last post2019-10-21 16:34 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  image refresh Andrew Poulos <ap_prog@hotmail.com> - 2019-10-21 18:19 +1100
    Re: image refresh Andrew Poulos <ap_prog@hotmail.com> - 2019-10-21 19:38 +1100
      Re: image refresh "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-10-21 12:06 +0200
    Re: image refresh Arno Welzel <usenet@arnowelzel.de> - 2019-10-21 16:34 +0200

#37590 — image refresh

FromAndrew Poulos <ap_prog@hotmail.com>
Date2019-10-21 18:19 +1100
Subjectimage refresh
Message-ID<7vCdnZ7_BaCawTDAnZ2dnUU7-T_NnZ2d@westnet.com.au>
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;

Andrew Poulos

[toc] | [next] | [standalone]


#37591

FromAndrew Poulos <ap_prog@hotmail.com>
Date2019-10-21 19:38 +1100
Message-ID<Bf6dnd23VeIW8zDAnZ2dnUU7-NnNnZ2d@westnet.com.au>
In reply to#37590
On 21/10/2019 6:19 pm, 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;

In my testing the first image that got created was

<img
src="http:/ap_prog.com/exercises/ip3qexmgx1ektwx053sj/000000000000.png?t=1571646597695" 

onerror="this.onerror=null; this.src=loc + 'images/imagenotfound.png'">

When the user inputs some data the image on the server changes but the 
one in the page doesn't change - the console is showing src to have a 
time stamp of 1571646786836 but the image is still the one with 
1571646597695.

How do I get it to reliably update?

Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#37592

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-10-21 12:06 +0200
Message-ID<XnsAAEF7B2884437eejj99@194.109.6.166>
In reply to#37591
Andrew Poulos <ap_prog@hotmail.com> wrote on 21 Oct 2019 in
comp.lang.javascript: 

> On 21/10/2019 6:19 pm, 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;
> 
> In my testing the first image that got created was
> 
> <img
> src="http:/ap_prog.com/exercises/ip3qexmgx1ektwx053sj/000000000000.png?t=
> 1571646597695" 
> 
> onerror="this.onerror=null; this.src=loc + 'images/imagenotfound.png'">
> 
> When the user inputs some data the image on the server changes but the 
> one in the page doesn't change - the console is showing src to have a 
> time stamp of 1571646786836 but the image is still the one with 
> 1571646597695.
> 
> How do I get it to reliably update?

<https://stackoverflow.com/questions/1077041/refresh-image-with-a-new-one-
at-the-same-url>


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#37594

FromArno Welzel <usenet@arnowelzel.de>
Date2019-10-21 16:34 +0200
Message-ID<h15u0gFmtmgU1@mid.individual.net>
In reply to#37590
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web