Jump to content
Sign in to follow this  
malcolmcro

Refresh and location.reload(true) images

Recommended Posts

I have a weather station which uploads jpg images to my web site each 5 minutes.

I need to refresh my web page to show these images.

Last year the refresh instruction in html used to work fairly well on PC but not on Apple.

This year the page updates but not the images.

www.lanzcam.com/windsurfing/weather.html

See www.lanzcam.com/windsurfing/weather6.html for a simplified example

I would prefer an automatic reload but even a reload button does not reload images

 

 

 

 

 

 

weather6.html

Share this post


Link to post
Share on other sites

It sounds like a cache problem. What I would do is to only update the image and not the whole page.

 

Access the image element and change its src attribute. You can force it to reload the image from the server by appending a query string to the URL:

imageElement.src = "http://www.lanzcam.com/windsurfing/vws295.jpg?v=" + Math.random();

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...