Use window.open():

<a onclick="window.open(document.URL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');">
  Share Page
</a>

This will create a link titled Share Page which opens the current url in a new window with a height of 570 and width of 520.

Answer from citruspi on Stack Overflow
🌐
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.
🌐
W3Schools
w3schools.com › jsref › met_win_open.asp
Window open() Method
window.open("http://www.google.com/"); window.open("https://www.w3schools.com/"); Try it Yourself » · Open a new window.
Discussions

javascript - Open a URL in a new tab (and not a new window) - Stack Overflow
I've tested the below given answers from duke and arikfr and they work perfectly fine in FF, Chrome and Opera except IE (where it doesn't work) and Safari (where it opens in new window instead of new tab). 2013-04-05T07:15:44.65Z+00:00 ... @AliHaideri The Javascript has nothing to do with how ... More on stackoverflow.com
🌐 stackoverflow.com
Best practices for opening new window (pop up or pop under) with JavaScript
Is there a general consensus of best practices in regards to opening a new pop up (or pop under) window with JavaScript with pop up blockers? Yeah. Don't. More on reddit.com
🌐 r/javascript
10
0
April 12, 2011
Open in new window in JS
Hi folks, I am trying to get this to open in a new window but not sure how: console.log('before clickMe'); let clickMe = document.querySelector(".header-right a"); clickMe.addEventListener("click", (e) => { console.log("clickMe clicked."); e.preventDefault(); window.location = "http://www.... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
April 24, 2019
Using html button + javascript function to open links in new window - JavaScript - SitePoint Forums | Web Development & Design Community
Hi all, Im trying to set up a function where once a html button is pressed, a function checks a variable and redirects a link to a new window if the value comes back positive. This is the function I’m trying to get goi… More on sitepoint.com
🌐 sitepoint.com
0
August 1, 2018
🌐
JavaScript.info
javascript.info › tutorial › frames and windows
Popups and window methods
A popup window is one of the oldest methods to show additional document to user. ... …And it will open a new window with given URL.
🌐
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.
🌐
Coderanch
coderanch.com › t › 118092 › languages › options-opening-window
options for opening a new window (HTML Pages with CSS and JavaScript forum at Coderanch)
One large drawback to using a window.open() is the IE information bar that appears when a supposed pop-up is encountered. An alternative to window.open is to use the target tag on a link or form. But that doesn't give you as much control.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Mozilla › Add-ons › WebExtensions › API › windows › create
windows.create() - Mozilla | MDN
July 17, 2025 - Move a tab from an existing window into the new window. Set the size and position of the window. Create a "panel" style window, which in this context means a window without any of the normal browser UI (address bar, toolbar, etc.). Set various properties of the window, such as whether it is focused or private. This is an asynchronous function that returns a Promise. ... boolean. When the window is opened...
Find elsewhere
🌐
Reddit
reddit.com › r/javascript › best practices for opening new window (pop up or pop under) with javascript
r/javascript on Reddit: Best practices for opening new window (pop up or pop under) with JavaScript
April 12, 2011 -

Here at work, we do a fair bit of surveys on various sites via Survey Monkey. The MO has always been to do a pop under window - focus the parent, not the child/new window. I've stressed how I think this is slimey (hiding the new window), but it is what it is and that's that :)

Seems every time we have a survey, I'll get people coming to me because the new window is getting blocked by someone. I've looked at the code they're using and it's using the typical window.onload event. I tell them this is probably why they're getting blocked as the pop up blockers are no doubt seeing automatically opened windows as unwanted advertising. Because the window onload and onunload events have been so abused, this is why we have pop up blockers built into browsers as well as plugins.

I thought about perhaps using a timer to delay execution of the pop up from onload, but not sure if this will make any difference. I'm kind of guessing not but I haven't tested it yet. I can't really test it as it's another dept. that has access to the server, not me... I've also thought about using onmousemove to trigger it (user-triggered event) and then nulling that out but that seems even more stupid.

I've suggested adding static survey promos which would be user-triggered events as I think those might fare better in the world of pop up blockers - even though there's still no guarantee. So the user clicks to pop the new window.

I've also suggested removing JS from the equation altogether and having the promos link straight to Survey Monkey. The counter there is that they've lost where they are in our site (they could have deep-linked in). They can't just easily close the Survey Monkey window to pick back up where they left off in their task. Off the top of my head, I don't know if they can use their back button to backtrack from the end of the Survey Monkey survey, either.

Is there a general consensus of best practices in regards to opening a new pop up (or pop under) window with JavaScript with pop up blockers?

🌐
DEV Community
dev.to › digvijaysingh › how-to-open-a-new-tab-or-window-using-javascript-5ebc
How to Open a New Tab or Window using Javascript? - DEV Community
October 23, 2020 - Here are the code snippets to open a link in a new tab or new window by pure Vanilla Javascript.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window
Window - Web APIs | MDN
Moves the window to the specified coordinates. ... Opens a new window.
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Open in new window in JS - JavaScript - The freeCodeCamp Forum
April 24, 2019 - Hi folks, I am trying to get this to open in a new window but not sure how: console.log('before clickMe'); let clickMe = document.querySelector(".header-right a"); clickMe.addEventListener("click", (e) => …
🌐
SitePoint
sitepoint.com › javascript
Using html button + javascript function to open links in new window - JavaScript - SitePoint Forums | Web Development & Design Community
August 1, 2018 - Hi all, Im trying to set up a function where once a html button is pressed, a function checks a variable and redirects a link to a new window if the value comes back positive. This is the function I’m trying to get going: function launchTask() { window.open("https://www.google.com","_blank"); } and the button button type=“button” onclick=“LaunchTask()” Theres probably a basic solution i’m not seeing, can somebody help?
🌐
Quora
quora.com › How-can-I-open-a-new-browser-window-with-JavaScript
How to open a new browser window with JavaScript - Quora
Answer (1 of 2): You want to call [code javascript]window.open[/code] and set a height in the third parameter. For example: [code javascript]window.open("http://www.example.com", "_BLANK", "height=400");[/code] The general syntax of window.open is: [code javascript]winRef = window.open( URL, na...
🌐
Educative
educative.io › answers › how-to-open-a-link-in-a-new-tab-with-html-and-javascript
How to open a link in a new tab with HTML and JavaScript
HTML’s target="_blank" is the simplest method to open links in a new tab, requiring no additional scripting. JavaScript provides dynamic control using window.open(), making it ideal for programmatically opening links in new tabs.
🌐
Medium
medium.com › @progmacattack › open-a-link-in-a-new-window-with-vanilla-javascript-1e8298612b8f
Vanilla Javascript: Open a link in a new window | by Adam S. | Medium
November 16, 2015 - var portfolioLinks = document.getElementById("portfolio-details"); portfolioLinks.addEventListener("click",portfolioLinkClicked,false) }//if a portfolio link is clicked, open in new window function portfolioLinkClicked(e) { var url = e.target.href; window.open(url,"","titlebar=no"); } There are a lot of customization options from here. ... <a href=”http://codepen.io/asickmiller/full/KdXXZE/" onclick=”return false”>Wikipedia Search</a><br /> Well that keeps the html from loading the link at all. What I mean is, since Javascript is loading the link from the href string in a new window, we don’t want our HTML doing the same thing in the background.
🌐
SitePoint
sitepoint.com › javascript
Forcing links to open in new browser window - JavaScript - SitePoint Forums | Web Development & Design Community
November 17, 2010 - Can someone share Javascript code to force links to open in a new browser window? The link will be ad generated by Javascript code. Here is a bit more detail about my situation. I am creating a web-based mobile app. …
🌐
Reintech
reintech.io › blog › tutorial-working-with-the-window-open-method
Working with the window.open() Method | Reintech media
February 22, 2023 - The window.open() method is a powerful function in JavaScript used to open new browser windows or tabs and manipulate existing ones. It accepts three parameters: URL, window name, and window features.
🌐
OutSystems
outsystems.com › forums › discussion › 65977 › open-link-in-a-new-window-not-tab
Open link in a new window (NOT TAB) | OutSystems
I have a link on my page, and I want it to open it in a new window (not a new tab) when clicking it. Currently, this link points to a new screen action, and in this new screen action I have a RunJavaScript server action with the following script: · However, it still open the link in new tab ...