InterviewHubPRO
Section Overview
Q124

Question 124 of 521

Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

24%
JavaScript Internals (521 Qs)•Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)

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,

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