Posts Learn Components Snippets Categories Tags Tools About

URL Redirect One-Liner Snippet

Learn how to define URL Redirect With One-Liner Snippet

Created on Jun 28, 2022


To redirect a user to a specific URL / Location you can make use of the "location.href " object and it will automatically redirect the page
const urlRedirect = url => location.href = url;
Now you can use the function below anywhere on your web page.
urlRedirect(""); // it will automatically navigate to the URL

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for URL Redirect One-Liner Snippet