Skip to content

Go lib to open a link with the default web browser in the background. Works on Mac, Linux and Windows.

License

Notifications You must be signed in to change notification settings

bacongobbler/browser

Repository files navigation

Browser

Go lib to open a link with the default web browser in the background. Works on Mac, Linux and Windows.

On Windows and Mac, the cmd and open utilities are installed by default, so there's no additional requirement necessary. For linux distributions, the xdg-utils package is required to open the browser window. xdg-utils is required for Linux Standards Base (LSB) conformance, so it should be available on most distributions of Linux.

This project is a copypasta of pkg/webbrowser from the workflow-cli project which we worked on at Deis. Chocolates and flowers should be sent to @Joshua-Anderson for all his hard work figuring out the right commands to invoke the default web browser from the terminal.

Usage

package main

import (
	"log"

	"github.com/bacongobbler/browser"
)

func main() {
	if err := browser.Open("https://example.com"); err != nil {
		log.Fatal(err)
	}
}
$ go get github.com/bacongobbler/browser
$ go run main.go

About

Go lib to open a link with the default web browser in the background. Works on Mac, Linux and Windows.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages