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> 

Share

Posted in JavaScript

You can also read...

Leave a Reply

Your email address will not be published.