FrontendDeveloper.in

JavaScript question 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";
}
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399