Need help with gweb?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

169 Stars 14 Forks MIT License 214 Commits 0 Opened issues


Interact with browser from Go. Manually crafted WebAPI interoperation library.

Services available


Need anything else?

Contributors list

GWeb: golang + js + wasm

gweb -- strictly typed WebAPI library on top of syscall/js. Like flow or TypeScript but for Go. You need it if you want to interact with browser from wasm-compiled Go program.


  • Strictly typed. It's a wrapper around
    that helps you to avoid runtime errors (you'll get them a lot with raw
  • Backward compatible. Almost every type is a wrapper around
    . So if something missed, you can always fall back to the classic
  • Hand crafted. It's hard to make a usable autogeneration of WebAPI since Go is a strictly typed language without union types. So we carefully translated everything while applying Go best practices.
  • Cleaned up. The library provides only useful methods and attributes from WebAPI. No obsolete and deprecated methods, no experimental APIs that are only supported by a few engines. Only what we really need right now.
  • Almost the same API as in JS. If you have experience with vanilla JS, you have almost learnt everything about the libray.
  • But better. WebAPI has a long history of incremental changes and spaces for unimplemented dreams. However, we can see the full picture to provide a better experience and more namespaces.
  • Documented. Every method is documented to save your time and reduce googling.


GOOS=js GOARCH=wasm go get

If you're using VSCode, it's recommend to create a

file in your project with the following content:
    "go.toolsEnvVars": {
        "GOARCH": "wasm",
        "GOOS": "js",
    "go.testEnvVars": {
        "GOARCH": "wasm",
        "GOOS": "js",

Error handling

In the beautiful JS world anything at any time can be

. Check it when you're not sure:
doc := web.GetWindow().Document()
el := doc.Element("some-element-id")
if el.Type() == js.TypeNull {
    // handle error

Missed API

If something is missed, use

-like methods (
doc := web.GetWindow().Document()
el := doc.Element("some-element-id")
name = el.Get("name").String()


GWeb is a collection of a few packages:

  • web
    (docs) -- window, manipulations with DOM.
  • audio
    (docs) -- Web Audio API. Use
    as an entry point.
  • canvas
    (docs) -- canvas-related objects. Use
    to get started.
  • css
    (docs) -- manage styles for HTML elements.


Contributions are welcome! GWeb is a Open-Source project and you can help to make it better. Some ideas what can be improved:

  • Every function and object should have short description based on MDN Web API docs. Some descriptions are missed.
  • Also, every function that calls a Web API method should have a link in docs for that method.
  • Typos are very possible, don't be shy to fix it if you've spotted one.
  • More objects and methods? Of course! Our goal is to cover everything in WebAPI! Well, excluding deprecated things. See Features section to get feeling what should be there.
  • Found a bug? Fix it!

And even if you don't have spare time for making PRs, you still can help by talking to your friends and subscribers about GWeb. Thank you :heart:

Similar projects

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.