First, while target=_newTab
will work, it only does so because newTab
is meaningless to HTML, so you get the default action, which is to target the URL to a new tab. But, the correct way to do that is to say target=_blank
.
And, as a side note, when targetting new, blank windows, make sure to add rel="noopener noreferrer"
to your a
tags as well to prevent opening up a security hole in your web page.
Now, to open several new tabs, you must use JavaScript and call window.open()
several times. Given that this is not normal behavior for an anchor element, I would advise using a different element, like a span
to have the user click on.
Note that the following code won't work here in the Stack Overflow code snippet environment because of security restrictions, but it will work in other pages.
document.querySelector(".multipleWindows").addEventListener("click", function(){
window.open("https://cnn.com");
window.open("https://hbo.com");
window.open("https://cbs.com");
});
.multipleWindows { color:blue; cursor:pointer; }
<span class="multipleWindows">Click to open several windows</span>