Jump to content

Refresh and location.reload(true) images


malcolmcro

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

Link to comment
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();
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...