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 open() method of the Window interface loads a specified resource into a new or existing browsing context (that is, a tab, a window, or an iframe) under a specified name.
🌐
SitePoint
sitepoint.com › javascript
Having trouble with window.open and _self - JavaScript - SitePoint Forums | Web Development & Design Community
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!!
🌐
Infimum
infimum.dk › HTML › JSwindows.html
Javascript windows - Infimum Border Design
There are four predefined targets: "_blank", "_self", "_parent", and "_top". Their meanings are: In Javascript, you can simulate a click on the above link with the code: ... 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).
🌐
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.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › opener
Window: opener property - Web APIs | MDN
April 10, 2025 - self · location: with only the Location.replace and Location.href properties available · close · closed · focus · blur · frames · length · top · opener · parent · postMessage · window[0], window[1], etc. In addition, there are a few properties: then, [Symbol.toStringTag], [Symbol.hasInstance], [Symbol.isConcatSpreadable], which are used by various JavaScript operations.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-window-open-method
JavaScript window.open() Method - GeeksforGeeks
August 5, 2025 - The Javascript window.open() method is used to open a new tab or window with the specified URL and name.
🌐
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.
Find elsewhere
🌐
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...
🌐
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.
🌐
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.
🌐
Linux Hint
linuxhint.com › window-open-javascript
What is window.open() in JavaScript
October 21, 2022 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
🌐
Stack Overflow
stackoverflow.com › questions › 15398509 › open-window-self-and-also-execute-javascript-for-the-new-window
html - open window self and also execute javascript for the new window - Stack Overflow
after clicking a button, a new window is opened with: the code i have in my javascript is something like that: $("#kitchen_menu a").bind('click',function(e){ if(window.location.href = "products.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-window-open-window-close-method
Javascript Window Open() & Window Close() Method | GeeksforGeeks
August 1, 2024 - The Javascript Window.Open() method is used to open the web pages into a new window or a new tab.
🌐
TutorialsPoint
tutorialspoint.com › target-a-window-using-javascript-or-html
Target a Window Using JavaScript or HTML
December 12, 2022 - _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.
🌐
HTML Goodies
htmlgoodies.com › home › javascript
Window Open | Javascript Popup Windows | HTML Goodies
April 27, 2021 - That little script will work and open a new browser window and you’ll get the effect. But wouldn’t it be great if we actually had the ability to configure the window any way we wanted? You bet. Here’s how. ... Now we get to the commands I used on this page to get the little window effect. This is exactly what I have: <SCRIPT LANGUAGE=”javascript”> <!– window.open (‘titlepage.html’, ‘newwindow’, config=’height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no’) –> </SCRIPT>
🌐
JavaScripter
javascripter.net › faq › openinga.htm
JavaScript: open a window
Opening a window with JavaScript JavaScript FAQ | JavaScript Windows FAQ · Question: How do I open a new browser window
🌐
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 - Use the "window.open()" method ... to load in the same window and in the same tab. The "_self" parameter specifies that the URL should be loaded in the current window....