How to reload page every 5 seconds? HTML / JS / JavaScript

auto reloauto reload-refresh html js-wordpress
auto reloauto reload-refresh html js-wordpress

For HTML, add this code inside <body>
Change URL link when you insert it in your page.

<!--For HTTP-->
<meta http-equiv="refresh" content="5; URL=http://www.yourdomain.com/yoursite.html">
<!--For HTTPS-->
<meta http-equiv="refresh" content="5; URL=https://www.yourdomain.com/yoursite.html">

If it has to be in the script use setTimeout like:

5000 milliseconds = 5 seconds

<script type="text/javascript">
setTimeout(function(){
   window.location.reload(1);
}, 5000);
</script>

For auto reload and clear cache after 3 second you can do it easily using javascript setInterval function. Here is simple code :

<script type="text/javascript">
$(document).ready(function() {
  setInterval(function() {
    cache_clear()
  }, 3000);
});

function cache_clear() {
  window.location.reload(true);
  // window.location.reload(); use this if you do not remove cache
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<p>Auto reload page and clear cache</p>

Also you can use this code for your wordpress website or HTML pages: