This language bar is your friend. Select your favorite languages!

Idiom #164 Open URL in default browser

Open the URL s in the default browser.
Set boolean b to indicate whether the operation was successful.

using System.Diagnostics;
var b = true;
    Process.Start(new ProcessStartInfo()
        FileName = s,
        UseShellExecute = true,
catch { b = false; }
import std.process;
import ""
b := open.Start(s) == nil
func openbrowser(url string) {
	var err error

	switch runtime.GOOS {
	case "linux":
		err = exec.Command("xdg-open", url).Start()
	case "windows":
		err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
	case "darwin":
		err = exec.Command("open", url).Start()
		err = fmt.Errorf("unsupported platform")
	if err != nil {

uses LclIntf;
b := OpenUrl(s);
use Browser::Open qw(open_browser);
my $b = open_browser $s;
import webbrowser
use webbrowser;
webbrowser::open(s).expect("failed to open URL");

Do you know the best way to do this in your language ?
New implementation...

Idiom created by