You need to use the name attribute:

window.open("https://www.youraddress.com","_self")

Edit: Url should be prepended with protocol. Without it tries to open relative url. Tested in Chrome 59, Firefox 54 and IE 11.

Answer from vdbuilder on Stack Overflow
🌐
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.
🌐
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.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › open
Window: open() method - Web APIs | MDN
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.
🌐
RNT Lab
rntlab.com › question › html-open-url-in-same-window-and-in-same-tab
HTML – Open URL in same window and in same tab
"{window.open('/serverIndex', '_ self')}" "{location.href ='/serverIndex'}" "{window.location.replace('/serverIndex'}" "{window.location.href = '/serverIndex'}" The first one opens the new page in a new tab, with the other three nothing happens. Paul ... I only had time to properly test and give you the solution to this problem. Here’s how to load the /serverIndex page in the same tab. You need to make two changes to the const char* loginIndex. First change, in the very first line, add this attribute (action=’javascript:void(0);’).
🌐
Delft Stack
delftstack.com › home › howto › javascript › javascript open url in same tab
How to Open URL in the Same Window or Tab in JavaScript | Delft Stack
February 2, 2024 - The window.open() method is a JavaScript pre-defined window technique for opening a new tab or window in the same window and tab in the browser.
Find elsewhere
🌐
Sololearn
sololearn.com › en › Discuss › 346470 › how-to-open-url-in-same-window-and-in-same-tab
How To Open URL in same window and in same tab ??? | Sololearn: Learn to code for FREE!
I want to open a link in the same window and in the same tab that contains the page with the link. When I try to open a link by using window.open, then it opens in new tab—not in the same tab in the same window. ... If you want to do this in HTML: <a href = "page.html" target = "_self"> </a> Else, use Javascript: window.open('page.html', '_self'); Bye.
🌐
Mycode
mycode.blog › lakshmi › open-linkurl-same-tabwindow-or-new-tab-html-js
Open Link/URL in Same Tab/Window or New Tab in HTML & JS | mycode.blog
October 30, 2023 - In JavaScript, if you want to open a link in the same tab or window, you can do so by setting window.location to the new URL, effectively replacing the current page. On the other hand, to open a link in a new tab, you can utilize the window.open() ...
🌐
w3tutorials
w3tutorials.net › blog › open-url-in-same-window-and-in-same-tab
How to Open a URL in the Same Window and Tab Using JavaScript (Fixing window.open New Tab Issue) — w3tutorials.net
If using window.open(), set target="_self" and omit the features parameter to force same-tab behavior. By following these methods, you’ll avoid the "new tab" issue and ensure a smooth user experience.
🌐
UsefulAngle
usefulangle.com › post › 337 › html-open-links-in-same-tab
Open Links in a New Tab, Or Re-Use Already Existing Tab
<!-- same target attribute --> ... 3</a> If opening the links with Javascript open() method, the same window name needs to be provided for the given set of links....
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-open-url-in-new-tab-using-javascript
How to Open URL in New Tab using JavaScript? - GeeksforGeeks
It returns null if it fails to open the new tab. Avoid adding a third parameter to the window.open() method because it could result in a new window instead of a tab.
Published   August 21, 2025
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-open-url-in-a-new-window-using-javascript
How to open URL in a new window using JavaScript? - GeeksforGeeks
August 21, 2025 - The anchor tag (<a>) can also be utilized with JavaScript to open URLs in new windows or tabs. By specifying target="_blank", the link will open in a new tab.