EXAMPLES.md

December 18, 2025 ยท View on GitHub

Examples:

Open URL in Default Browser

err := browser.OpenURL("https://example.com")
if err != nil {
    fmt.Println("Error opening browser:", err)
} else {
    fmt.Println("Browser opened successfully")
}

Open URL with Path

err := browser.OpenURL("https://example.com/path/to/page")
if err != nil {
    fmt.Println("Error:", err)
}

Open URL with Query Parameters

err := browser.OpenURL("https://example.com/search?q=golang&page=1")
if err != nil {
    fmt.Println("Error:", err)
}

Open Local File

// Open a local HTML file
err := browser.OpenURL("file:///path/to/file.html")
if err != nil {
    fmt.Println("Error:", err)
}