Skip to content

Instantly share code, notes, and snippets.

@0xffan
Forked from lambdamusic/Snipplr-39840.js
Last active August 29, 2015 14:13
Show Gist options
  • Save 0xffan/93f44a78b1337a6b5a84 to your computer and use it in GitHub Desktop.
Save 0xffan/93f44a78b1337a6b5a84 to your computer and use it in GitHub Desktop.
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[name].focus();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment