How do I redirect with JavaScript?

In this Tutorial learn to how to redirect url with javascript, Redirect the user from one page to another using jQuery or pure JavaScript,  this code add to the javascript window.setTimeout(function(){ window.location = "http://www.yoururl.com"; },3000);



Example  index.php


<!DOCTYPE html>
<html lang="en">
<head>

  <meta charset="utf-8">
  <title>Set Cellpadding in CSS</title>

</head>

<body>

  <table>
    <thead>
      <tr>
        <th>Row</th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>1</td>
        <td>Clark</td>
        <td>Kent</td>
        <td>clarkkent@gmail.com</td>
      </tr>
      <tr>
        <td>2</td>
        <td>Peter</td>
        <td>Parker</td>
        <td>john@gmail.com</td>
      </tr>
      <tr>
        <td>3</td>
        <td>John</td>
        <td>Rambo</td>
        <td>johnrambo@gmail.com</td>
      </tr>
    </tbody>
  </table>

</body>
</html>

<script type="text/javascript">

window.setTimeout(function(){ window.location = "http://localhost/home.html"; },3000);

</script>
</script>




No comments:

Post a Comment

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...