Created
August 13, 2014 17:41
-
-
Save distractdiverge/18f854c88ed774d647a2 to your computer and use it in GitHub Desktop.
Open Windows & Redirect / Close
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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