# Packages
No description provided by the author
# README
hyperlink
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
andhttps
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
andhttps
schemes.
- Opens the link in the default browser. Currently, only supports
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.
- Sent to
Features
Features | Windows | Android | MacOS | iOS | WebAssembly | FreeBSD | Linux |
---|---|---|---|---|---|---|---|
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.