This tutorial will help you to redirect a webpage to another webpage using JavaScript. Here are 3 examples of redirecting webpage to another with JavaScript.

Advertisement

Example 1:

We can redirect user to other page using window.location.replace in JavaScript. window.location.replace has pretty similar to an HTTP redirect.

Example 2:

It is better to use window.location.href in place of window.location.replace, because replace() function does not put the originating page in the session history.

Example 3:

We can also simply redirect to any internal website page using window.location.

Share.
Leave A Reply


Exit mobile version