Fork of webview/webview_go with extra features. Go language binding for the webview library.
- Cookie Management — Full cross-platform cookie APIs (
GetCookies,SetCookie,DeleteCookie,ClearCookies) with native implementations for macOS (WebKit), Linux (WebKitGTK), and Windows (WebView2). - SetUserAgent — Update the native user agent string used by the embedded browser engine.
See Go package documentation for the Go API documentation, or simply read the source code.
Start with creating a new directory structure for your project.
mkdir my-project && cd my-projectCreate a new Go module.
go mod init example.com/appSave one of the example programs into your project directory.
curl -sSLo main.go "https://raw.githubusercontent.com/GopeedLab/webview_go/master/examples/basic/main.go"Install dependencies.
go get github.com/GopeedLab/webview_goBuild the example. On Windows, add -ldflags="-H windowsgui" to the command line.
go buildCalling Eval() or Dispatch() before Run() does not work because the webview instance has only been configured and not yet started.
Cookie APIs are available through GetCookies, SetCookie, DeleteCookie, and ClearCookies on darwin, linux, and windows. They should be called on the UI thread.