I want to open a url in default browser like internet explorer 11, firefox but url should not open browser if default browser is edge or google chrome. Below code open the url in default browser, I want to restrict launch of browser if default browesr is edge or google chrome.
public class LaunchBrowser {
public static void main(String args[])
{
String url = "http://www.google.com";
String os = System.getProperty("os.name").toLowerCase();
Runtime rt = Runtime.getRuntime();
try{
if (os.indexOf( "win" ) >= 0) {
rt.exec( "rundll32 url.dll,FileProtocolHandler " + url);
}
catch(Exception e){
return;
}
}
}