Menu

gitpiper

redirect javascript Code Snippet in 2024

browserbeginner

Last Updated: 20 April 2024

Redirects to a specified URL.

  • Use Window.location.href or Window.location.replace() to redirect to url.
  • Pass a second argument to simulate a link click (true - default) or an HTTP redirect (false).
const redirect = (url, asLink = true) => asLink ? (window.location.href = url) : window.location.replace(url);
redirect('https://google.com');

javascript snippet similar to redirect For You in April 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️