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
๐ŸŒ
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.
Discussions

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
Call pop up window always on top - JavaScript - SitePoint Forums | Web Development & Design Community
Not real big with JS but am going through a bunch of books and tuts ect. For the moment I would like to know if there is a way to call up a pop up window from a button (have that done already) but have it stay on top of the main browser when you click back on the main browser. More on sitepoint.com
๐ŸŒ sitepoint.com
0
August 10, 2011
Window.open and pop up blocker
Hi, I have a contact page which is opening in a new window using window.open. Since this is called when the user clicks a link, pop up blocker don't block it. However, I want to show a survey after this window has been closed. I find nothing else but to use window.open. But this time, I use... More on thecodingforums.com
๐ŸŒ thecodingforums.com
3
December 8, 2004
How do I code a JavaScript pop up window
What is the best and easiest way to have a modal window pop up in JavaScript code? I have a function in JavaScript where I would like to put a modal pop up window code in so what I know it is being hit. I did a search engine search on the internet for examples of this but everything I found was a... More on forums.caspio.com
๐ŸŒ forums.caspio.com
13
December 13, 2017
๐ŸŒ
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 (!
๐ŸŒ
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 ...
๐ŸŒ
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.
๐ŸŒ
QuirksMode
quirksmode.org โ€บ js โ€บ popup.html
JavaScript - Popups
See below for a far cleaner way of adding popup behaviour to a link. First, you open the new window. The page to be opened is passed on by the argument url. Note that, if you want to open a page on another server, Explorer will frequently give errors. This is a feature, not a bug, so there's little you can do about it. You have to give a name to the window (in this case, name). This name can be used as the target of a link. In addition, you have to load the window into a JavaScript ...
Find elsewhere
๐ŸŒ
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.
๐ŸŒ
Gotfusion
gotfusion.com โ€บ tutstd โ€บ inlinepop.cfm
Using an in line javascript to open a new window
gotFusion the number 1 source for NetObjects Fusion resources, help, information, and tutorials. The place where web designers come for inspiration and answers
๐ŸŒ
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?

๐ŸŒ
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 ...
๐ŸŒ
SitePoint
sitepoint.com โ€บ javascript
Call pop up window always on top - JavaScript - SitePoint Forums | Web Development & Design Community
August 10, 2011 - Not real big with JS but am going through a bunch of books and tuts ect. For the moment I would like to know if there is a way to call up a pop up window from a button (have that done already) but have it stay on top ofโ€ฆ
๐ŸŒ
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>
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-center-a-popup-window-on-screen
How to center a popup window on screen? - GeeksforGeeks
August 6, 2025 - <!DOCTYPE html> <html> <head> <title> Non-centered popup window on the screen </title> </head> <body> <h1>GeeksforGeeks</h1> <p> Non-centered popup window on the screen </p> <script> function createPopupWin(pageURL, pageTitle, popupWinWidth, popupWinHeight) { let left = (screen.width); let top = (screen.height); let myWindow = window.open(pageURL, pageTitle, 'resizable=yes, width=' + popupWinWidth + ', height=' + popupWinHeight + ', top=' + top + ', left=' + left); } </script> <button onclick="createPopupWin('https://www.geeksforgeeks.org//', 'GeeksforGeeks Website', 1200, 650);"> GeeksforGeeks </button> </body> </html>
๐ŸŒ
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 - In this approach we are using the visibility property in CSS to toggle the visibility of a popup dialog. When the "Open Popup" button is clicked, the openPop() function is called.
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_popup.asp
JavaScript Popup Boxes
JavaScript has three kinds of popup ... up, the user will have to click "OK" to proceed. window.alert("sometext"); The window.alert() method can be written without the window prefix....
๐ŸŒ
Codestore
codestore.net โ€บ store.Nsf โ€บ unid โ€บ DOMM-4PYJ3S
Managing JavaScript "popup" windows - Article - CodeStore
Example: popup = window.open("someURL.html", "myPopup"); popup.focus(); ... I'm a newbie to Javascript, and have got the code shown here to work okay if I click the link, view the picture and then select the 'close window' link that I have provided.
๐ŸŒ
The Coding Forums
thecodingforums.com โ€บ archive โ€บ archive โ€บ javascript
Window.open and pop up blocker | Javascript | Coding Forums
December 8, 2004 - However, I want to show a survey after this window has been closed. I find nothing else but to use window.open. But this time, I use the onunload tag in the opened window. This is blocked by pop up blockers.
๐ŸŒ
Leaflet
leafletjs.com โ€บ reference.html
Documentation - Leaflet - a JavaScript library for interactive maps
Use Map.openPopup to open popups while making sure that only one popup is open at one time (recommended for usability), or use Map.addLayer to open as many as you want.
๐ŸŒ
Caspio
forums.caspio.com โ€บ bridge framework โ€บ general questions
How do I code a JavaScript pop up window - General Questions - Caspio Community Forums
December 13, 2017 - What is the best and easiest way to have a modal window pop up in JavaScript code? I have a function in JavaScript where I would like to put a modal pop up window code in so what I know it is being hit. I did a search engine search on the internet for examples of this but everything I found was a...