Here is the answer is divided into two parts
- Open each URL in unique new window
- Open each URL in same new window
in both of the cases, only few words need to be changed
Open Each URL in Unique window
`<!doctype html>
<html><head><title>Open Windows</title>
<script>
function openWindow(){
var x = document.getElementById(\'a\').value.split(\'\ \');
for (var i = 0; i < x.length; i++)
if (x.indexOf(\'.\') > 0)
if (x.indexOf(\'://\') < 0)
window.open(\'http://\'+x);
else
window.open(x);
}
</script>
<style>body,html{height:99%;width:99%}textarea{height:80%;width:90%}</style>
</head>
<body>
<textarea id="a"></textarea><br>
<input type="button" value="Open Windows" onClick="openWindow()">
<input type="button" value="Clear" onClick="document.getElementById(\'a\').value=\'\'">
</body>
</html>`
source: https://superuser.com/a/385221/1203263
Open Each URL in Same window
Only difference is script mentioned above is tweaked to open with delay and in same window
`<!doctype html>
<html><head><title>Open Windows</title>
<script>
function openWindow(){
var x = document.getElementById(\'a\').value.split(\'\ \');
atTime = 0;
for (var i = 0; i < x.length; i++) {
if (x.indexOf(\'.\') > 0) {
site = x;
if (x.indexOf(\'://\') < 0) { site = \'http://\' + x; }
setTimeout("window.open(\'" + site + "\',\'newwindow4\',\'width=400,height=400\')", atTime);
atTime += 20000;
}
}
}
</script>
<style>body,html{height:99%;width:99%}textarea{height:80%;width:90%}</style>
</head>
<body>
<textarea id="a"></textarea><br>
<input type="button" value="Open Windows" onClick="openWindow()">
<input type="button" value="Clear" onClick="document.getElementById(\'a\').value=\'\'">
</body>
</html>`
source https://superuser.com/a/649093/1203263
Here is code working in codepen.io if want to try out