Skip to content

abemedia/go-webview

Repository files navigation

go-webview

Go Reference CI Go Report Card

Go bindings for webview/webview using purego, with no CGO, and prebuilt native libraries for Windows, macOS, and Linux.

Features

  • No CGO
  • Cross-platform (Windows, macOS, Linux)
  • Prebuilt dynamic libraries included
  • Bind Go functions to JavaScript
  • Fully embeddable in pure Go projects

Basic Example

package main

import (
	"github.com/abemedia/go-webview"
	_ "github.com/abemedia/go-webview/embedded" // embed native library
)

func main() {
	w := webview.New(true)
	w.SetTitle("Greetings")
	w.SetSize(480, 320, webview.HintNone)
	w.SetHtml("Hello World!")
	w.Run()
	w.Destroy()
}

See ./examples/bind for an example binding Go functions to JavaScript.

Building for Windows

When building Windows apps, set the following flag: -ldflags="-H windowsgui".

go build -ldflags="-H windowsgui" .

Embedded Libraries

This package requires native WebView libraries per-platform. To embed them in your app import the embedded package.

import _ "github.com/abemedia/go-webview/embedded"

Or you can ship your application with .dll, .so, or .dylib files. Ensure these are discoverable at runtime by placing them in the same folder as your executable. For MacOS .app bundles, place the .dylib file into the Frameworks folder.

See the embedded folder for pre-built libraries you can ship with your application.

Acknowledgements

About

Go bindings for webview using purego, with no CGO.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •  

Languages