Menu Close

How to use JavaScript to redirect a webpage?

Codeamend

Here, we will see how to redirect webpage using JavaScript. Check the below codes that we used to redirect the webpage after 3s using setTimeout fucnction.

Example:

<!DOCTYPE html>
<html>
   <body>
      <script>
         setTimeout(function(){
            window.location.href = 'https://codeamend.com/blog/category/javascript/';
         }, 3000);
      </script>
      <p>Web page redirects after 3 seconds.</p>
   </body>
</html> 
Posted in JavaScript

You can also read...