I am making a multiple url opener too in HTML and Javascript. I am getting some problems that HTTP links are opening but HTTPS links are not. Can anyone help me with that? Here is the code.
function open_all() {
var urls = document.getElementById("list_urls").value;
var urls = urls.split('
');
var totalno = urls.length;
var s;
for (var i = 0; i < totalno; i++) {
s = urls[i];
if (s) {
if (s.substr(0, 7) != 'http://') {
s = 'http://' + s;
}
window.open(s);
}
}
return false;
}
<form method="post" action="">
<br />
<textarea name="list_urls" id="list_urls" cols="60" rows="20"></textarea>
<br />
<br />
<input value="Open URLs" class="submit" type="button" onClick="open_all();">
<br />
<input type="reset" value="Reset!">
<br/>
</form>
See Question&Answers more detail:os