I have the following code and need to open two new tabs pointing to 2 web sites. For example: www.google.com and www.yahoo.com
It works only if I put one site in there
In the bad old days, it was common for malicious websites to fork bomb browsers by triggering an infinite loop of new windows.
They implemented protection against this by allowing new windows (and tabs) to be opened only when the function was triggered by a user event (e.g. a click but not a page load) and restricting this to opening a single window.
Some browsers may prompt the user to allow an additional window to open, but there is no way for a website to simply bypass this important security feature.
I run your code. Both sites opened. But before it opens browser blocked popup window so i had to allow it to open. Try your code. And dont forget to allow popup after pressing button.