browser

package
v6.9.2-0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package browser provides cross-platform functionality for opening URLs in the default web browser. It abstracts the underlying operating system commands and provides a simple interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseBrowser

func CloseBrowser() error

CloseBrowser closes the last opened browser process.

func GetPlatformInfo

func GetPlatformInfo() map[string]interface{}

GetPlatformInfo returns a map containing details about the current platform's browser opening capabilities, including the OS, architecture, and available commands.

Returns:

  • A map with platform-specific browser support information.

func IsAvailable

func IsAvailable() bool

IsAvailable checks if the system has a command available to open a web browser. It verifies the presence of necessary commands for the current operating system.

Returns:

  • true if a browser can be opened, false otherwise.

func IsIncognitoMode

func IsIncognitoMode() bool

IsIncognitoMode returns whether incognito mode is enabled.

func OpenURL

func OpenURL(url string) error

OpenURL opens the specified URL in the default web browser. It uses the pkg/browser library which provides robust cross-platform support for Windows, macOS, and Linux. If incognito mode is enabled, it will open in a private/incognito window.

Parameters:

  • url: The URL to open.

Returns:

  • An error if the URL cannot be opened, otherwise nil.

func SetIncognitoMode

func SetIncognitoMode(enabled bool)

SetIncognitoMode enables or disables incognito/private browsing mode.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL