Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open multiple tabs in the same browser by JavaScript

I would like to open multiple tab in the main browser: Here is my code:

    function openSM()
    {
        window.open("http://www.google.com","_blank");
        window.open("http://www.yahoo.com","_blank");
        window.open("http://www.bing.com","_blank");
    }
...
<div onClick="openSM()"> This is a div </div>

But only the first window open in new tab, the other windows open in a new browser. What I should do to open every page in the same browser?

like image 958
Carl Mark Avatar asked Mar 23 '26 08:03

Carl Mark


1 Answers

Unfortunately, you have no control over this so you will not be able to force a new tab to open programmatically. It's the browser that controls that feature, which can generally be configured by users.

It could only be forced if you have control over the client's browser configuration and/or can install extensions in the client's browser (often the case in intranets)

like image 148
plalx Avatar answered Mar 25 '26 22:03

plalx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!