Skip to content

Instantly share code, notes, and snippets.

@hmahadik
Created August 19, 2021 15:18
Show Gist options
  • Save hmahadik/f77385e4260db608db3ad422b2227a6d to your computer and use it in GitHub Desktop.
Save hmahadik/f77385e4260db608db3ad422b2227a6d to your computer and use it in GitHub Desktop.
Refreshes the first HTML img element every 5 seconds.
let interval = setInterval(()=>{
let img = document.getElementsByTagName("img").item(0);
img.src = img.src;
console.log("Reloaded. Next reload in 5s.");
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment