I have a static method used to launch a browser with a given URL. When the browser is already open, this takes over the active browser window.
This is a problem if the browser is in use for something else, such as data entry. Is there a way to open a URL in a new Browser window (or tab)?
public static void openURL(String urlText) { if (Desktop.isDesktopSupported()) { URI uri = URI.create(urlText); try { Desktop.getDesktop().browse(uri); } catch (IOException e) { e.printStackTrace(); } } }
Alternately, is there a better way to do this?
Have a look at BrowserLaunch2. In particular this method for forcing a new window to be opened.