I have a code snippet that opens one tab pointing to a website, but I need it to open two. For example: www.google.com and www.yahoo.com
Currently, it only works with one site in the code:
window.open("https://www.google.com");
but not when both URLs are included:
window.open("https://www.google.com");
window.open("https://www.yahoo.com");
Can anyone advise on how to modify the code to make it open tabs for both sites?
(function() {
document.getElementById("btnAsync").addEventListener('click', makeRequest);
function makeRequest() {
var httpRequest = new XMLHttpRequest(); // Initiatlization of XMLHttpRequest
if (!httpRequest) {
alert(' Cannot create an XMLHTTP instance');
return false;
}
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === XMLHttpRequest.DONE) {
if (httpRequest.status === 200) {
alert(httpRequest.responseText);
} else {
alert('There was a problem with the request.');
}
}
};
window.open("https://www.google.com");
window.open("https://www.yahoo.com");
}
})();
<button id="btnAsync" type="button">Click Me</button>