Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a URL in IE tabs and not new windows - Java

I'm bit of a noob so please bear with me. I'm trying to open a lot of urls in internet explorer at once. About 40 urls.

I have an array of my urls and I'm using the following code:

for (int i = 0; i < urls.length; i++){
        java.awt.Desktop.getDesktop().browse(java.net.URI.create(urls[i]));
}

This works perfectly if I already have IE open. However if it's not open already it creates 40 new windows not tabs. I have tried to get around it by using the following:

for (int i = 0; i <= 9; i++){
        java.awt.Desktop.getDesktop().browse(java.net.URI.create(urls[i]));
        try {
            Thread.currentThread().sleep(200);
        } catch (InterruptedException ex) {
            Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
like image 860
Peck3277 Avatar asked Oct 21 '11 09:10

Peck3277


People also ask

How to open a URL in a new tab using JavaScript?

How to open a URL in a new tab (and not a new window) using JavaScript? Opening of a URL in a new tab depends on the browser and the user's browser preferences. There is nothing you can do in code to force open a link strictly in a new tab.

Why can't I open a URL in IE Tab?

If a URL matches an Auto URL Exception string, it will not be opened in IE Tab even if the URL also matches an Auto URL. The format for Auto URL Exceptions is the same as the format for Auto URLs. See above.

How do I open a URL in a new IE window?

You can also open an URL from the Start Process action but this might open in another IE window rather than a Tab (if that's fine with you) in which case you need not bother much about the Launch/Detach. Then Attach to this new IE window using the same approach as above. Post back what you come up with. Click to expand...

How do I enable auto URLs in Internet Explorer?

Now navigate to any page and click on the IE Tab icon to open the page with the IE rendering engine. That's it! Right-click on the IE Tab icon and select "Options" to see all of the options, including the Auto URLs.


1 Answers

200, is just too small, i have tryed 1000 and it was also too small, but 2000 was OK. And of course, open the first one, then wait, and then open all the others at once.

like image 107
kajacx Avatar answered Oct 06 '22 00:10

kajacx