window.open target _self v window.location.href?

javascript

Solution

Definitely the second method is preferred because you don't have the overhead of another function invocation:

window.location.href = "webpage.htm";

Problem

I need to redirect the user using JavaScript. Which is the preferred method? ``` window.open("webpage.htm", "_self"); ``` or ``` window.location.href = "webpage.htm"; ```

Original source