This project demonstrates two methods of redirecting users from one webpage to another. The first method uses JavaScript for client-side redirection, while the second method employs the HTML meta refresh technique.
url-redirection-explorer/
├── index.html
└── page/
└── index.html
This file uses the HTML meta refresh method to redirect users to a new URL after a specified delay. Here’s a brief code snippet from the file:
<meta http-equiv="refresh" content="0; URL='https://example.com'" />
- How it works: The
meta
tag instructs the browser to redirect to the specified URL after a specified delay (0 seconds in this case for an immediate redirect).
This file implements a JavaScript redirect to send users to a new URL immediately upon loading the page. Here’s a brief code snippet from the file:
<script>
window.location.href = "https://example.com";
</script>
- How it works: The JavaScript
window.location.href
command sets the current page’s URL to the specified one, effectively redirecting the user immediately.
To set up this project on your local machine, follow these steps:
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd URL-REDIRECTION-EXAMPLE
- Open the
index.html
file in your browser to see the meta refresh in action. - Open the
page/index.html
file in your browser to see the JavaScript redirect.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to submit issues or pull requests if you have suggestions for improvements or additional features.