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
Note: open() calls cannot be used to register an attribution trigger. ... By default, window.open opens the page in a new tab. If popup is set to true, it requests that a minimal popup window be used. The UI features included in the popup window will be automatically decided by the browser, generally including an address bar only.
🌐
W3Schools
w3schools.com › jsref › met_win_open.asp
Window open() Method
The open() method opens a new browser window, or a new tab, depending on your browser settings and the parameter values.
🌐
GitHub
gist.github.com › sttk › 22e74eaadde493265f38c539f3cafb37
Window open · GitHub
If this value is "_blank", opens a new window and make it target. If this value is "_self", opens no new window and make the window itself target.
🌐
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…
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › opener
Window: opener property - Web APIs | MDN
To be exact, for cross-origin opener objects, the following properties are available: window · self · location: with only the Location.replace and Location.href properties available · close · closed · focus · blur · frames · length · top · opener ·
🌐
GitHub
github.com › whatwg › html › issues › 2636
Sort out window.opener behavior when a window.open with target targets an existing window · Issue #2636 · whatwg/html
<!DOCTYPE html> <input type="button" onclick="alert(opener + ' ' + (opener == window))" value="check opener"> <input type="button" onclick="window.open(location.href, '_self')" value="do open">
Find elsewhere
🌐
CodexWorld
codexworld.com › home › how to guides › how to open url in same window and tab using javascript
How to Open URL in Same Window and Tab using JavaScript - CodexWorld
April 15, 2023 - The JavaScript window.open() method allows you to open URL in the browser tab or window. You can use _self value in the second parameter of the window.open() method to open the URL in the same tab and in the same window with JavaScript.
🌐
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.
🌐
Apache Cordova
cordova.apache.org › archive › docs › en › 2.5.0 › cordova › inappbrowser › window.open.html
window.open - Apache Cordova
Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. ... _self - opens in the Cordova WebView if url is in the white-list, else it opens in the InAppBrowser _blank - always open in the InAppBrowser _system - always open in the system web browser
🌐
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...
🌐
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.
🌐
Infimum
infimum.dk › HTML › JSwindows.html
Javascript: Managing windows
Since "window" is a reference to the global object, the function is also a global variable, and can be referred to by just "open" (unless another variable with the same name is in the scope). It is traditionally written out as "window.open", which helps to distinguish it from "document.open".
🌐
Reality Ripple
udn.realityripple.com › docs › Web › API › Window › open
Window.open() - Web APIs
This is useful for preventing untrusted sites opened via window.open() from tampering with the originating window, and vice versa. Note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab.