Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Update page 10 second

I don’t know how to say it right, sorry in advance.
I want to make a page of the site js that the page can be updated every 10 seconds, does anyone have an example?

**that the user can refresh the page every 10 seconds**
I want my user on my site to be able to refresh the page once every 10 seconds

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can make button that will show after 10 seconds so user can but also don’t have to update.

setTimeout(function(){
   let button = document.querySelector('button');
   button.style.display = "block";
   button.onclick = () => window.location.reload();
}, 10000);

window.onkeydown = (e) => {
  if(e.key === 'F5'){
    e.preventDefault()
  }
}
button {
display:none;
}
<button>Click me</button>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading