Skip to content

Instantly share code, notes, and snippets.

@distractdiverge
Created August 13, 2014 17:41
Show Gist options
  • Save distractdiverge/18f854c88ed774d647a2 to your computer and use it in GitHub Desktop.
Save distractdiverge/18f854c88ed774d647a2 to your computer and use it in GitHub Desktop.
Open Windows & Redirect / Close
function openWindowsAndRedirectTo(windows, url) {
var _windows = windows,
_len = function() { _windows.length; };
for( var i = 0, len = _len(); i < len; i++ ) {
_windows[i] = {
url: _windows[i],
instance: null
};
_windows[i].instance = window.open(_windows[i]);
setTimeout(1000, function(){
_checkAllWindowsOpen({
"yes": function(){
_windows[i].instance.close();
window.location.replace(url);
},
"no": {
_windows[i].instance.close();
}
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment