Reputation: 13
function input_check() {
var num = $("#num").val();
var sys = $("#sys").val();
var tp = $("#tp").val();
var urlstring1 = "";
var urlstring2 = "";
if (sys === 'QA') {
if (tp === 'ACOs') {
urlstring1 = "http://stackoverflow.com";
urlstring2 = "http://google.ca";
window.open(urlstring2);
window.open(urlstring1);
}
else {
console.log(0)
};
};
};
$(document).ready(function() {
$('#checkBtn').on('click', input_check);
});
I want Stackoverflow and Google open, but
when sys === 'QA' and tp === 'ACOs', Google opens but Stackoverflow not.
if I change the window.open order, the first page will open but second page not. For example,
window.open(urlstring1);
window.open(urlstring2); // the urlstring2 and urlstring1 change order. Now it only opens the urlstring1.
Upvotes: 0
Views: 539
Reputation: 2175
According to MDN Reference Window.open() , you also probably need to add a target:
window.open(urlstring1, "target1");
window.open(urlstring2, "target2");
Upvotes: 0
Reputation: 4743
This will be due to your browsers popup blocker, which usually only allows on popup per user action.
Upvotes: 1