Change the window name in your two different calls:

function popitup(url,windowName) {
       newwindow=window.open(url,windowName,'height=200,width=150');
       if (window.focus) {newwindow.focus()}
       return false;
     }

windowName must be unique when you open a new window with same url otherwise the same window will be refreshed.

Answer from Umesh on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › open
Window: open() method - Web APIs | MDN - Mozilla
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.
🌐
Quackit
quackit.com › javascript › popup_windows.cfm
JavaScript Popup Windows
If you only want to open a new browser window you can add the target="_blank" attribute within the <a> element (see this article on opening a new window in HTML). JavaScript popup windows however, are more powerful. Using JavaScript's window.open() method, you can determine what the window ...
🌐
JavaScript.info
javascript.info › tutorial › frames and windows
Popups and window methods
The open call returns a reference to the new window. It can be used to manipulate its properties, change location and even more. In this example, we generate popup content from JavaScript:
🌐
HTML.com
html.com › javascript › popup-windows
Popup Windows Made Easy: Here's The JavaScript Code To Copy And Paste »
March 19, 2020 - For more details, see Under the Hood: Details of the Popup Script. First, copy this script into the “ section of your page: <SCRIPT TYPE="text/javascript"> function popup(mylink, windowname) { if (!
🌐
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.
🌐
Javascript-coder
javascript-coder.com › window-popup › javascript-window-open
Using the window.open method | JavaScript Coder
URL The URL of the page to open in the new window. This argument could be blank. windowName A name to be given to the new window. The name can be used to refer this window again. windowFeatures A string that determines the various window features to be included in the popup window (like status bar, address bar etc) The following code opens a new browser window with standard features.
Find elsewhere
🌐
QuirksMode
quirksmode.org › js › popup.html
JavaScript - Popups
You can add a TARGET="_blank" to the <a>-tag, but this simply opens a new browser window that completely obscures the old one. This may be what you want, but at other times a small window on top of the large browser window is much better. This small window is popularly known as a popup.
🌐
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?

🌐
Laurentian
web.cs.laurentian.ca › rsgrewal › c2206 › javascript › examples › windows › windows.html
Opening a pop up window
Close pop up window and click the following link to open it again. ... This method uses a special form of link which just executes a javascript function. ... Other useful features are menubar="yes", resizable="yes", scrollbars="yes", toolbar="yes", and status="yes". Note that the javascript designers cannot spell: use resizable not resizeable. The default values are "no". Click the following link to see a popup window with these values turned on.
🌐
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>
🌐
Your HTML Source
yourhtmlsource.com › html source › javascript › popup windows | open new customised windows with javascript
Popup Windows | open new customised windows with JavaScript
November 17, 2025 - Create and control JavaScript popup windows with custom dimensions, toolbars, and positioning for auxiliary content and user interaction.
🌐
SitePoint
sitepoint.com › blog › javascript › js code snippet to open a popup window
js code snippet to open a popup window — SitePoint
February 13, 2024 - Here is a basic example: var myWindow = window.open("", "myWindow", "width=200,height=100"); myWindow.document.write("<p>This is 'myWindow'</p>"); In this example, the window.open() method takes three parameters: the URL of the page to open (left blank here to create an empty window), the name of the window, and a string indicating the window’s features (like its width and height). You can control the size and position of the popup window by specifying them in the third parameter of the window.open() method.
🌐
EncodedNA
encodedna.com › 2013 › 09 › javascript-window-open-method.htm
Open a New Browser Window using JavaScript open() Method
&lthtml> &lthead>&lt/head> &ltbody> &ltinput type="button" value="Click Me" onclick="openMultipleWindows()" /> &lt/body> &ltscript type="text/javascript"> function openMultipleWindows() { var win1 = window.open('popupwindow.htm', 'Win 1', 'width=600, height=600, top=70, left=100, resizable=1, menubar=yes', true); var win2 = window.open('popupwindow.htm', 'Win 2', 'width=600, height=600, top=70, left=100, resizable=1, menubar=yes', true); } &lt/script> &lt/html>
🌐
Quora
quora.com › How-do-you-create-a-new-popup-window-in-JavaScript
How to create a new popup window in JavaScript - Quora
Answer (1 of 2): I would suggest you to use window.open() Here is the syntax and parmeter of window.open(): window.open(URL, windowName, [windowFeatures]) URL: The URL of the page to open.
🌐
Natclark
natclark.com › tutorials › javascript-open-popup-window
Open Popup Window in JavaScript – Natclark
This one-liner, which uses the default window.open method, is all you need to open a popup window in JavaScript:
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-open-a-popup-on-click-using-javascript
How to Open a Popup on Click using JavaScript ? - GeeksforGeeks
August 5, 2025 - Example: In this example we uses the visibility property to toggle a popup dialog's visibility. The Open Popup button shows the dialog, while the "Close" button hides it by toggling visibility between visible and hidden.
🌐
Codestore
codestore.net › store.nsf › unid › DOMM-4PYJ3S
Managing JavaScript "popup" windows - Article - Codestore.net
If you need to open multiple different windows then use this function instead: popupWins = new Array(); function windowOpener(url, name, args) { /******************************* the popupWins array stores an object reference for each separate window that is called, based upon the name attribute that is supplied as an argument *******************************/ if ( typeof( popupWins[name] ) != "object" ){ popupWins[name] = window.open(url,name,args); } else { if (!popupWins[name].closed){ popupWins[name].location.href = url; } else { popupWins[name] = window.open(url, name,args); } } popupWins[n