304 North Cardinal St.
Dorchester Center, MA 02124
But what made it so popular and important? Let’s find out some of the amazing features that made this programming language so popular.
URL or Uniform resource locator, often known as a web address which is a reference to a particular location on a computer network. Technically, when a HTTP request for one page goes to another page automatically, then is it called redirection.
In simple terms, URL redirecting is a way to redirect a web page to any particular location or a page. For example, say you open a website and you see a web page with a link.
When you click on that link you are redirected to an entirely new web page with a different layout. Sometimes it may happen that you may click on a link and the same page opens again. This is known as URL redirecting.
All you need to do is assign a URL to it. For example if you want to redirect your web page to “demoxyz.com” then simply write the following code.
Sometimes, you might see window.location instead of window.location.href in some code. Both ways are the same except the difference is that, window.location returns an object. You can observe the difference in your web browsers console.
This means that the back button of the browser can’t be used. The replace method is useful when you don’t want the user to navigate back to the previous URL using the back button. The syntax for this method is:
[su_label type=”info”]Also check[/su_label]5 Best IDE for React and ReactJs text editors
In the replace method you can’t go back to the previous page using the back button, but in the assign method the users will be able to go back to the original page using the back button. Following is the syntax for assign method:
window.location.assign(“ your URL name”);
However, this method will not if the previous page does not exist in the list. The syntax for this method is:
[su_label type=”info”]Also check[/su_label]11 Best Editor for Web Development IDEs trending