Currently, I am working on creating a multiple URL opener using HTML and JavaScript. However, I have encountered an issue where HTTP links are opening fine but HTTPS links are not. Can someone provide assistance with this problem? Below is the code snippet.
function open_all() {
var urls = document.getElementById("list_urls").value;
var urls = urls.split('\n');
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>
Any help would be greatly appreciated!