webbrowser: github.com/toqueteos/webbrowser Index | Files

package webbrowser

import "github.com/toqueteos/webbrowser"

Package webbrowser provides a simple API for opening web pages on your default browser.

Index

Package Files

webbrowser.go

Variables

var (
    ErrCantOpenBrowser = errors.New("webbrowser: can't open browser")
    ErrNoCandidates    = errors.New("webbrowser: no browser candidate found for your OS")
)
var Candidates []Browser

Candidates contains a list of registered `Browser`s that will be tried with Open.

func Open Uses

func Open(s string) (err error)

Open tries to open a URL in your default browser ensuring you have a display set up and not running this from SSH. NOTE: This may cause your program to hang until the browser process is closed in some OSes, see https://github.com/toqueteos/webbrowser/issues/4.

type Browser Uses

type Browser interface {
    // Command returns a ready to be used Cmd that will open an URL.
    Command(string) (*exec.Cmd, error)
    // Open tries to open a URL in your default browser. NOTE: This may cause
    // your program to hang until the browser process is closed in some OSes,
    // see https://github.com/toqueteos/webbrowser/issues/4.
    Open(string) error
}

Package webbrowser imports 7 packages (graph) and is imported by 125 packages. Updated 2020-10-21. Refresh now. Tools for package owners.