Tuesday, January 1, 2013

Open URL in Browser Programatically -IE/FF/Chrome [Windows Forms]

Problem:
I want to open a URL in desktop web browser programatically.
I want to open it in different browsers of my choice.

Solution:
Here are some code blocks to open a url in the browsers of our choice.

Below code will open a specific url in your default browser configured:
System.Diagnostics.Process.Start("http://www.habeeb.in");

To open the url in Internet Explorer, use the code:
System.Diagnostics.Process.Start("iexplore.exe", "http://www.habeeb.in");

To open the url in firefox, use the code:
System.Diagnostics.Process.Start("firefox.exe", "http://www.habeeb.in");

To open the url in Chrome, use the code:
System.Diagnostics.Process.Start("chrome.exe", "http://www.habeeb.in");







These solutions are based on Windows Desktops Winforms Applications.

No comments:

Post a Comment