package
0.1.0
Repository: https://github.com/gioui-plugins/gio-plugins.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

hyperlink

Go Reference

Open a hyperlink in the default browser.


Usage

Freestanding

  • hyperlink.NewShare:
    • Creates a instance of Share struct, given the config.
  • hyperlink.Configure:
    • Updates the current Share with the given config.
  • hyperlink.Open:
    • Opens the link in the default browser.
    • By default, only supports http and https schemes.

Gio

Non-Plugin:

If you want to use it without plugin, read the Freestanding instructions. We provide some helper functions, such as NewConfigFromViewEvent and such.

To open one link, you can use the Open operation.

That will open the link in the default browser. You can use OpenURL to open a *url.URL:

giohyperlink.OpenOp{URI: &url.URL{
    Scheme: "https",
    Host:   "github.com",
}}.Add(gtx.Ops)

Operations:

Operations must be added with .Add(gtx.Ops) method. The operation will be executed at the end of the frame.

  • giohyperlink.OpenOp:
    • Opens the link in the default browser. Currently, only supports http and https schemes.

Events:

Events are response sent using the Tag and should be handled with gtx.Events().

  • giohyperlink.ErrorEvent:
    • Sent to Tag when it's not possible to open the hyperlink.

Features

FeaturesWindowsAndroidMacOSiOSWebAssemblyFreeBSDLinux
HTTP
HTTPS

By default, only HTTP and HTTPS links are allowed, but you can change that by changing InsecureIgnoreScheme to true, you should validate the URL and scheme on your own.