// off-screen image to preload next image var newImage = new Image(); newImage.src = "https://proxy.mariense.pt/pformosa-spotazores";
// remember the image height to prevent showing broken images var height = newImage.naturalHeight;
function updateImage() { // for sure if the first image was a broken image if(newImage.naturalHeight > height) { height = newImage.naturalHeight; }
// off-screen image loaded and the image was not broken if(newImage.complete && newImage.naturalHeight == height) { // show the preloaded image on page document.getElementById("webcam").src = newImage.src; }
// preload next image with cachebreaker newImage.src = "https://proxy.mariense.pt/pformosa-spotazores?time=" + new Date().getTime();
// refresh image (set the refresh interval to half of webcam refresh, // webcam refreshes every 3 seconds) setTimeout(updateImage, 3000); }
Voltar atrás – Go Back
Operado por SpotAzores.