skip to Main Content
Javascript Redirect User To Another Page

Javascript redirect user to another page

Today, We are going to learn How can We redirect a user from one page to another page using JAVASCRIPT. Sometimes, We need to redirect from one page to another using JAVASCRIPT. Once, the Ajax request is complete in many cases we need to redirect a user to another page using JAVASCRIPT. So, Let’s see Javascript redirect user to another page.

Javascript redirect user to another page

window.location.replace("https://thecodingstuff.com");

window.location.href = "https://thecodingstuff.com";

Using “window.location” we can redirect a user from one page to another page. You can get more information about window.location from here.

I prefer to use “window.location.href” instead of “window.location.replace” Because the replace method doesn’t keep the originating page in the history. The user gets stuck in Back history fiasco.

Saroj

I am a web designer and developer part-time blogger. Write something on some free time. Find my every day thought here :)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top