webview

Join the chat at https://gitter.im/zserge/webview Build Status GoDoc Go Report Card

A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Nim bindings, Haskell, C# bindings and Java bindings available.

The goal of the project is to create a common HTML5 UI abstraction layer for the most widely used platforms.

It supports two-way JavaScript bindings (to call JavaScript from C/C++/Go and to call C/C++/Go from JavaScript).

It uses Cocoa/WebKit on macOS, gtk-webkit2 on Linux and Edge on Windows 10.

Webview for Go developers

If you are interested in writing Webview apps in C/C++, skip to the next section.

Getting started

go get
$ go get github.com/zserge/webview

Import the package and start using it:

To build the app use the following commands:

For more details see godoc.

Distributing webview apps

.desktop

On MacOS you are likely to ship an app bundle. Make the following directory structure and just zip it:

example.app
└── Contents
    ├── Info.plist
    ├── MacOS
    |   └── example
    └── Resources
        └── example.icns
Info.plist*.icns
windreswebview.dllWebView2Loader.dll

Also, if you want to cross-compile your webview app - use xgo.

Migrating from v0.1.1 to v0.10.0

webview.Open()webview.Debug()webview.Debugf()webview.SettingsWebview.Loop()Run()WebView.Run()WebView.Terminate()WebView.SetTitle()WebView.Dispatch()WebView.Exit()WebView.Destroy()WebView.SetColor()WebView.SetFullScreen()Window()webview.DialogWebView.Eval()WebView.InjectCSS()WebView.Bind()

Webview for C/C++ developers

Download webview.h and include it in your C/C++ code:

Build it:

On Windows it is possible to use webview library directly when compiling with cl.exe, but WebView2Loader.dll is still required. To use MinGW you may dynamically link prebuilt webview.dll (this approach is used in Cgo bindings).

webview.h

Migrating from v0.1.1 to v0.10.0

webview_tstruct webviewwebview_bind()webview_return()webview()webview_init()webview_create()webview_exit()webview_destroy()webview_loop()webview_run()webview_terminate()webview_dispatch()webview_set_title()webview_set_color()webview_get_windowwebview_set_fullscreen()webview_dialog()webview_eval()webview_inject_css()webview_eval()webview_debug()

Notes

wxallowedsudo apt install webkit2gtk-4.0pkg install webkit2-gtk3

License

Code is distributed under MIT license, feel free to use it in your proprietary projects as well.