Typically, a URL redirection is done using server-side scripting using the browser's HTTP header. But there are many other ways as well, and using JavaScript is one of the common & safe ways to navigate from one URL to another. There are many scenarios where you might need to use JavaScript to redirect a page.
Let's first review the scenarios when you might need a JavaScript redirection and how you can do an HTTP URL redirection using JavaScript.