FrontendDeveloper.in

JavaScript Track Detail

How do you redirect new page in javascript

In vanilla javascript, you can redirect to a new page using the location property of window object. The syntax would be as follows,

function redirect() {
window.location.href = "newPage.html";
}