Open default browser with Mono + gtk #
I need to open a URL from my application, both in Linux and Windows, and I want to avoid replacing the existing page in an open browser.
How can I open it?
I know I can use
System.Diagnostics.Process.Start("http://mysite.com");
which should also work under Linux, but this will replace any page shown in an already open browser window.
I found this article (thanks to Nissan Fan ):
System.Diagnostics.Process.Start (" http://mysite.com ");
but this only works for windows and I need a solution that will work on both systems.
source to share
After searching through the Banshee source code, I see that they are using Gnome.Url.Show()
(In gnome-sharp) to open the default browser for users.
If this is not possible for some reason, a couple of other ideas come to mind.
If the user runs Gnome, there must be a program called "gnome-open" that should do the trick.
System.Diagnostics.Process.Start("gnome-open http://mysite.com");
And if that doesn't work, I know that (at least) all Debian based systems come with a script called sane browser.
System.Diagnostics.Process.Start("sensible-browser http://mysite.com");
source to share