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

window.location.href = "webpage.htm";
Answer from Jacob Relkin on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › open
Window: open() method - Web APIs | MDN
The special target keywords, _self, _blank (default), _parent, _top, and _unfencedTop can also be used. _unfencedTop is only relevant to fenced frames. This name can be used as the target attribute of <a> or <form> elements. ... A string containing a comma-separated list of window features in the form name=value.
🌐
W3Schools
w3schools.com › jsref › met_win_open.asp
Window open() Method
More examples below. The open() method opens a new browser window, or a new tab, depending on your browser settings and the parameter values. The close() method. ... var myWindow = window.open("", "MsgWindow", "width=200,height=100"); myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>"); Try it Yourself » ... var myWindow = window.open("", "_self"); myWindow.document.write("<p>I replaced the current window.</p>"); Try it Yourself »
🌐
SitePoint
sitepoint.com › javascript
Having trouble with window.open and _self
October 7, 2008 - if I do this: window.open(url_var,‘_self’); it works in IE but not in FF or chrome. but this: window.open(url_var); works in all 3 but opens a new window…I want to stay in the same window. Can I get a clue? THanks!!
🌐
W3Schools
www-db.deis.unibo.it › courses › TW › DOCS › w3schools › jsref › met_win_open.asp.html
Window open() Method
More "Try it Yourself" examples below. ... Tip: Use the close() method to close the window. ... var myWindow = window.open("", "MsgWindow", "width=200,height=100"); myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>"); Try it Yourself » ... var myWindow = window.open("", "_self"); myWindow.document.write("<p>I replaced the current window.</p>"); Try it Yourself »
🌐
Apache Cordova
cordova.apache.org › docs › en › 3.0.0 › cordova › inappbrowser › window.open.html
window.open - Apache Cordova
<!DOCTYPE html> <html> <head> <title>window.open Example</title> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8"> // Wait for device API libraries to load // document.addEventListener("deviceready", onDeviceReady, false); // device APIs are available // function onDeviceReady() { // external url var ref = window.open(encodeURI('http://apache.org'), '_blank', 'location=yes'); // relative document ref = window.open('next.html', '_self'); } </script> </head> <body> </body> </html>
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-window-open-method
JavaScript window.open() Method - GeeksforGeeks
August 5, 2025 - windowName: It can be used to provide the name of the window. This is not associated with the title of the window in any manner. It can accept values like _blank, _self, _parent, etc. windowFeatures: It is used to provide features to the window that will open, for example, the dimension and ...
Find elsewhere
🌐
GitHub
gist.github.com › sttk › 22e74eaadde493265f38c539f3cafb37
Window open · GitHub
If this value is "_parent", opens no new window and: If the window has a parent window, reload its parent window · If the window does not have its parent window (window.self === window.parent), make th window itself target.
🌐
Educative
educative.io › answers › what-is-the-windowopen-method-in-javascript
What is the window.open() method in JavaScript?
If no URL is indicated, a blank browser window will be opened. name: The name parameter is like the target attribute. It will specify if you want the new window to be one of the following: A new blank one: _blank will be used. To be loaded into the parent frame use _parent. Replace the current page use _self...
🌐
GeeksforGeeks
geeksforgeeks.org › html › how-to-open-url-in-same-window-and-same-tab-using-javascript
How to open URL in same window and same tab using JavaScript ? - GeeksforGeeks
July 24, 2025 - The "_self" parameter specifies that the URL should be loaded in the current window. Example: In this example, we have used the window.open() method to open the "geeksforgeeks.org" URL in the same window and in the same tab.
🌐
TutorialsPoint
tutorialspoint.com › target-a-window-using-javascript-or-html
Target a Window Using JavaScript or HTML
_top ? It replaces any existing frames in order to load the webpage into the browser window using full-body. _self ? _self is the target attribute's default value by default. It opens the webpage in the same window or frame that the link was opened in.
🌐
Openjavascript
openjavascript.info › home › dom manipulation
How to open a new browser window from JavaScript
October 3, 2022 - For example, to open a new window instance that replaces the current window: open("https://www.openjavascript.info", "_self"); // Opens URL in this window (replaces current window) If no second argument is specified, the default behavior is ...
🌐
Javatpoint
javatpoint.com › javascript-window-open-method
JavaScript Window open method - javatpoint
JavaScript Window open method with javascript tutorial, introduction, javascript oops, application of javascript, loop, variable, objects, map, typedarray etc.