Automatically refresh the web page after a certain period in the web browser. We will preset a time and the browser automatically refresh the web page.




Approach 1: use meta tag.


Example: Every 20 seconds web page will refresh

<meta http-equiv="refresh" content="20">




Approach 2: use JavaScript



Example: very 5 seconds web page will refresh

<!DOCTYPE html> 
<html> 
  
<head> 
    <title> 
        Reloading page after 5 seconds 
    </title> 
      
    <script> 
        function autoRefresh() { 
            window.location = window.location.href; 
        } 
        setInterval('autoRefresh()', 5000); 
    </script> 
</head> 
  
<body> 
    <h1>Hello world!</h1> 
</body> 
  
</html>