Documentation
¶
Overview ¶
Package openurl opens URLs in the user's default handler and reveals files in the platform file manager, cgo-free.
Each platform uses what the OS already ships — NSWorkspace on macOS, ShellExecuteW on Windows, xdg-open on Linux — with no C toolchain and no bundled native libraries.
openurl.Open("https://example.com")
openurl.Reveal("/path/to/file")
Security: Open only accepts http, https, mailto and file URLs. Any other scheme (or a bare string with no scheme) is rejected with ErrScheme, so a hostile value can't launch an arbitrary protocol handler. The string is never passed through a shell.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrScheme = errors.New("openurl: refused URL scheme")
ErrScheme is returned by Open when the URL's scheme is not in the allow-list.
var ErrUnsupported = errors.New("openurl: not supported on this platform")
ErrUnsupported is returned by operations on a platform that has no backend wired up yet.
Functions ¶
func Open ¶
Open opens rawurl with the user's default handler (browser, mail client, ...). Only http, https, mailto and file URLs are allowed; anything else — including a bare hostname or path with no scheme — returns ErrScheme. For a local file use a file:// URL, or Reveal to show it in the file manager.
Types ¶
This section is empty.