In this post, we will learn how to redirect to another webpage using JavaScript. Sometimes we have to redirect one webpage to another without wasting time, then we use JavaScript. With single line of JavaScript code, we can do this very easily. So how we can do this, we will learn in this post.

How To Redirect To Another Webpage Using JavaScript ?

Redirect To Another Webpage

To redirect to another webpage we use location.href window property of JavaScript. If you want to redirect to another webpage then simply copy paste this below code:

window.location.href = "";
</script> code-box

We can also use location.replace() instead of location.href . The location.replace() window property of JavaScript removes the current URL form the history. It means when user click on the back button then user can't back to the original URL.         

</script> code-box


In this post we learned how to redirect to another webpage using JavaScript. You try to make it yourself. I hope you make. If you face any problem, then comment and tell us. Keep visiting the blog to read more similar posts.

You also read this

Post a Comment

Previous Post Next Post