Documentation
¶
Overview ¶
Package browser opens a URL in the person's default browser with the platform's own opener: xdg-open on Linux and the BSDs, open on macOS, and url.dll's FileProtocolHandler through rundll32 on Windows (which, unlike `cmd /c start`, needs no quoting of & in a URL).
It reports ErrUnavailable instead of trying when there is clearly no way to show a browser — no opener on PATH, or a Linux session with no display (SSH, containers, CI) — so callers fall back to printing the link (spec/features/local-server-and-web-console#REQ:login-links).
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrUnavailable means no browser can be launched from this process.
Functions ¶
Types ¶
type Opener ¶
type Opener struct {
GOOS string // runtime.GOOS when empty
Getenv func(string) string // os.Getenv when nil
LookPath func(string) (string, error) // exec.LookPath when nil
Start func(name string, args ...string) error // starts without waiting when nil
}
Opener launches browsers. The zero value uses the real environment.