Below you can open the window only once:
if (typeof win !== 'object') { win = window.open('http://www.google.com'); } else {
As Sani suggested in another answer , it would be wise to keep track of when the window is closed in order to be able to re-open it. You can listen to the window.onunload event in a popup window, as shown below:
window.onunload = function() { window.opener.win = undefined; }
The onunload event onunload sets the global variable win in the window, opening the popup to undefined so that you can open the window again.
Remember that due to the same origin policy, this will only work if the popup is in the same domain as the parent window. Also, note that I just tested above in Firefox.
source share