Documentation
¶
Overview ¶
Package webkit binds WebKitGTK 4.1 (GTK 3) through purego, without cgo. gen_funcs.go holds the prototypes generated from GIR by tooling/webkitgen; the rest is written from the WebKitGTK, GObject and Soup reference documentation.
Index ¶
- func ClearSessionCookies(done func())
- func GetCookies(url string, done func([]Cookie))
- func Load() error
- func SetCookie(url, header string, done func(ok bool))
- type Config
- type Cookie
- type View
- func (v *View) AddScript(js string)
- func (v *View) Attach(container uintptr)
- func (v *View) CanGoBack() bool
- func (v *View) CanGoForward() bool
- func (v *View) Dispose()
- func (v *View) Eval(js string, done func(result, err string))
- func (v *View) GoBack()
- func (v *View) GoForward()
- func (v *View) LoadBytes(data []byte, mimeType, encoding, baseURL string)
- func (v *View) LoadHTML(html, baseURL string)
- func (v *View) LoadRequest(url string, headers map[string]string)
- func (v *View) LoadURL(url string)
- func (v *View) Reload()
- func (v *View) SetScriptEnabled(on bool)
- func (v *View) SetSize(w, h int)
- func (v *View) Stop()
- func (v *View) URL() string
- func (v *View) Widget() uintptr
- type WindowFeatures
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearSessionCookies ¶
func ClearSessionCookies(done func())
ClearSessionCookies deletes the cookies that have no expiry date.
func GetCookies ¶
GetCookies reports the cookies the stored jar would send to url.
Types ¶
type Config ¶
Config is fixed at New: WebKitGTK registers schemes on the context, so they cannot follow the view.
type Cookie ¶
type Cookie struct{ Name, Value string }
Cookie is the part of a cookie the webview package reports.
type View ¶
type View struct {
Message func(string)
TitleChanged func(string)
// Scheme answers a request on one of Config.Schemes; Content-Type goes in headers.
Scheme func(url, method string) (status int, headers map[string]string, body []byte)
// Decide is asked before each navigation; false cancels it. WebKitGTK does not say which frame
// navigates, so mainFrame is always true.
Decide func(url string, mainFrame bool) bool
// Call answers window.gowt.call(msg) from the page, which blocks in window.prompt meanwhile.
Call func(msg string) string
// NewWindow is asked when the page opens a window (window.open, target=_blank) and returns the view
// that takes the page, made by NewRelated inside the call; nil refuses the window.
NewWindow func(url string) *View
// Show fires once a window opened by the page is ready to be shown.
Show func(WindowFeatures)
// Close fires when the page asks to close its window (window.close).
Close func()
// Status gets the link under the pointer, "" when the pointer leaves it.
Status func(text string)
// contains filtered or unexported fields
}
func NewRelated ¶
NewRelated makes the view for a window the page of opener opens; call it inside opener.NewWindow. It shares the process, the context and the user content manager (scripts and message handler) of opener, so cfg.Scripts and cfg.Schemes are ignored.
func (*View) AddScript ¶
AddScript runs js at document start in every frame of pages loaded from now on.
func (*View) CanGoForward ¶
func (*View) Eval ¶
Eval runs js; done gets the value as text ("" for undefined) or the error message.
func (*View) LoadBytes ¶
LoadBytes shows data as a page of mimeType in encoding ("" lets WebKit decide), with baseURL as its address.
func (*View) LoadRequest ¶
LoadRequest loads url with extra request headers (GET only: WebKitGTK has no API for another method).
func (*View) SetScriptEnabled ¶
SetScriptEnabled switches the page scripts of this view for the pages loaded from now on. A view opened by the page gets settings of its own first, as WebKitGTK shares the opener's.
type WindowFeatures ¶
type WindowFeatures struct {
X, Y, Width, Height int
MenuBar, StatusBar, ToolBar, LocationBar bool
}
WindowFeatures are the window.open features of a window opened by the page; a zero Width and Height mean none were asked for.