Documentation
¶
Index ¶
- type CacheModel
- type Context
- func (c *Context) ClearCache()
- func (c *Context) GetCacheModel() CacheModel
- func (c *Context) GetProcessModel() ProcessModel
- func (c *Context) GetTLSErrorsPolicy() TLSErrorsPolicy
- func (c *Context) SetCacheModel(model CacheModel)
- func (c *Context) SetProcessModel(model ProcessModel)
- func (c *Context) SetTLSErrorsPolicy(policy TLSErrorsPolicy)
- type LoadEvent
- type ProcessModel
- type Settings
- func (s *Settings) GetAutoLoadImages() bool
- func (s *Settings) GetFrameFlattening() bool
- func (s *Settings) GetHTML5Database() bool
- func (s *Settings) GetJavaAllowed() bool
- func (s *Settings) GetJavascriptAllowed() bool
- func (s *Settings) GetOfflineCache() bool
- func (s *Settings) GetUserAgent() string
- func (s *Settings) SetAutoLoadImages(enabled bool)
- func (s *Settings) SetFrameFlattening(enabled bool)
- func (s *Settings) SetHTML5Database(enabled bool)
- func (s *Settings) SetJavaAllowed(enabled bool)
- func (s *Settings) SetJavascriptAllowed(enabled bool)
- func (s *Settings) SetOfflineCache(enabled bool)
- func (s *Settings) SetUserAgent(userAgent string)
- func (s *Settings) SetUserAgentWithApplicationDetails(appName, appVersion string)
- type TLSErrorsPolicy
- type WebView
- func (v *WebView) Context() *Context
- func (v *WebView) Destroy()
- func (v *WebView) GetSnapshot(resultCallback func(result *image.RGBA, err error))
- func (v *WebView) LoadHtml(content, baseURI string)
- func (v *WebView) LoadText(content string)
- func (v *WebView) LoadUri(uri string)
- func (v *WebView) Settings() *Settings
- func (v *WebView) Title() string
- func (v *WebView) URI() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheModel ¶
type CacheModel int
CacheModel describes the caching behavior.
const ( // DocumentViewerCacheModel disables the cache completely, which substantially reduces memory // usage. Useful for applications that only access a single local file, with no navigation to // other pages. No remote resources will be cached. DocumentViewerCacheModel CacheModel = iota // WebBrowserCacheModel improves document load speed substantially by caching a very large number // of resources and previously viewed content. WebBrowserCacheModel // DocumentBrowserCacheModel is a cache model optimized for viewing a series of local files, e.g. // a documentation viewer or a website designer. WebKit will cache a moderate number of resources. DocumentBrowserCacheModel )
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context manages aspects common to all WebViews.
func NewDefaultContext ¶
func NewDefaultContext() *Context
NewDefaultContext returns the default WebContext.
func (*Context) ClearCache ¶
func (c *Context) ClearCache()
ClearCache clears all resources currently cached.
func (*Context) GetCacheModel ¶
func (c *Context) GetCacheModel() CacheModel
GetCacheModel returns the current cache model.
func (*Context) GetProcessModel ¶
func (c *Context) GetProcessModel() ProcessModel
GetProcessModel returns the current process model.
func (*Context) GetTLSErrorsPolicy ¶
func (c *Context) GetTLSErrorsPolicy() TLSErrorsPolicy
GetTLSErrorsPolicy returns the current tls errors policy.
func (*Context) SetCacheModel ¶
func (c *Context) SetCacheModel(model CacheModel)
SetCacheModel sets the current cache model.
func (*Context) SetProcessModel ¶
func (c *Context) SetProcessModel(model ProcessModel)
SetProcessModel sets the current process model.
func (*Context) SetTLSErrorsPolicy ¶
func (c *Context) SetTLSErrorsPolicy(policy TLSErrorsPolicy)
SetTLSErrorsPolicy sets the current tls errors policy.
type LoadEvent ¶
type LoadEvent int
LoadEvent denotes the different events that happen during a WebView load operation.
See also: WebKitLoadEvent at http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#WebKitLoadEvent.
LoadEvent enum values are described at http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#WebKitLoadEvent.
type ProcessModel ¶
type ProcessModel int
ProcessModel describes the process behavior.
const ( // among all the WebKitWebView instances created by the application: if the process hangs or // crashes all the web views in the application will be affected. This is the default process // model, and it should suffice for most cases. SharedProcessModel ProcessModel = iota // MultipleProcessModel uses one process for each WebKitWebView, while still allowing for some // of them to share a process in certain situations. The main advantage of this process model // is that the rendering process for a web view can crash while the rest of the views keep working // normally. This process model is indicated for applications which may use a number of web views // and the content of in each must not interfere with the rest — for example a full-fledged web // browser with support for multiple tabs. MultipleProcessModel )
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings manages the behaviour of a single WebView.
func NewSettings ¶
func NewSettings() *Settings
NewSettings creates a new Settings with default values.
func (*Settings) GetAutoLoadImages ¶
GetAutoLoadImages gets whether images should be automatically loaded or not. On devices where network bandwidth is of concern, it might be useful to turn this property off.
func (*Settings) GetFrameFlattening ¶
GetFrameFlattening gets whether to enable the frame flattening. With this setting each subframe is expanded to its contents, which will flatten all the frames to become one scrollable page.
func (*Settings) GetHTML5Database ¶
GetHTML5Database gets whether to enable HTML5 client-side SQL database support. Client-side SQL database allows web pages to store structured data and be able to use SQL to manipulate that data asynchronously.
func (*Settings) GetJavaAllowed ¶
GetJavaAllowed gets whether or not Java is enabled on the page.
func (*Settings) GetJavascriptAllowed ¶
GetJavascriptAllowed gets whether or not JavaScript executes within the page.
func (*Settings) GetOfflineCache ¶
GetOfflineCache gets whether HTML5 offline web application cache support is enabled or not. Offline web application cache allows web applications to run even when the user is not connected to the network.
func (*Settings) GetUserAgent ¶
GetUserAgent gets the user-agent string used by WebKit.
func (*Settings) SetAutoLoadImages ¶
SetAutoLoadImages sets whether images should be automatically loaded or not. On devices where network bandwidth is of concern, it might be useful to turn this property off.
func (*Settings) SetFrameFlattening ¶
SetFrameFlattening sets whether to enable the frame flattening. With this setting each subframe is expanded to its contents, which will flatten all the frames to become one scrollable page.
func (*Settings) SetHTML5Database ¶
SetHTML5Database sets whether to enable HTML5 client-side SQL database support. Client-side SQL database allows web pages to store structured data and be able to use SQL to manipulate that data asynchronously.
func (*Settings) SetJavaAllowed ¶
SetJavaAllowed sets whether or not Java is enabled on the page.
func (*Settings) SetJavascriptAllowed ¶
SetJavascriptAllowed sets whether or not JavaScript executes within the page.
func (*Settings) SetOfflineCache ¶
SetOfflineCache sets whether HTML5 offline web application cache support is enabled or not. Offline web application cache allows web applications to run even when the user is not connected to the network.
func (*Settings) SetUserAgent ¶
SetUserAgent sets the user-agent string used by WebKit. Unusual user-agent strings may cause web content to render incorrectly or fail to run, as many web pages are written to parse the user-agent strings of only the most popular browsers. Therefore, it's typically better to not completely override the standard user-agent, but to use SetUserAgentWithApplicationDetails() instead.
func (*Settings) SetUserAgentWithApplicationDetails ¶
SetUserAgentWithApplicationDetails sets the “user-agent” property by appending the application details to the default user agent. If no application name or version is given, the default user agent used will be used. If only the version is given, the default engine version is used with the given application name.
type TLSErrorsPolicy ¶
type TLSErrorsPolicy int
TLSErrorsPolicy describes how tls errors are handled.
const ( // IgnoreTLSErrorsPolicy ignores TLS errors IgnoreTLSErrorsPolicy TLSErrorsPolicy = iota // FailTLSErrorsPolicy ensures that TLS errors will emit “load-failed-with-tls-errors” and, if // the signal is handled, finish the load. In case the signal is not handled, “load-failed” is // emitted before the load finishes. FailTLSErrorsPolicy )
type WebView ¶
WebView represents a WebKit WebView.
func NewWebView ¶
func NewWebView() *WebView
NewWebView creates a new WebView with the default Context.
func NewWebViewWithContext ¶
NewWebViewWithContext creates a new WebView with the given Contect.
func (*WebView) Destroy ¶
func (v *WebView) Destroy()
Destroy destroys the WebView's corresponding GtkWidget and marks its internal WebKitWebView as nil so that it can't be accidentally reused.
func (*WebView) GetSnapshot ¶
GetSnapshot runs asynchronously, taking a snapshot of the WebView. Upon completion, resultCallback will be called with a copy of the underlying bitmap backing store for the frame, or with an error encountered during execution.
See also: webkit_web_view_get_snapshot at http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#webkit-web-view-get-snapshot
func (*WebView) LoadHtml ¶
LoadHtml loads the given content into the WebView, with a mime-type of "text/html", and sets the base uri of the html content to the specified uri.
func (*WebView) LoadText ¶
LoadText loads the given content into the WebView, with a mime-type of "text/plain".