Webkit support for GTK4


I would like to use gtk4 for my Gjs app, but I need a WebKit WebView and was only able to do it with Gtk3.

What is the situation for Webkit on Gtk4 ?

Thanks !

See 210100 – (GTK4) [META][GTK][GTK4] Support GTK4

It should be good enough to use now as long as you (a) build it yourself, (b) ensure you don’t link to anything that uses libsoup2, and (c) understand the API is not stable and many planned breaks have not happened yet.

That’s exactly what I was looking for, thank you.

Please let us know how you did it when you manage to build it. And do consider that building needs a lot of free space on your SSD.

I was able to build it for GTK4 maybe 8 months ago, and I was able to successfully run a plain demo then. Later build failed, and last build 3 weeks ago with some Google instructions worked, but plain demo gave me “internal error” message then. Unfortunately Gentoo Linux does not ship it, but I would need it for testing the Nim bindings.

Arch Linux has had webkit2gtk-5.0 for a couple of weeks now. openSUSE Tumbleweed has it as well (I think it’s called webkit2gtk4). These seem to be the only two prebuilt options at the moment. Hopefully it’ll be available for in GNOME’s Flatpak runtime soon.

1 Like

FYI @heftig, the API version is still subject to change, like everything else. I’ve been arguing in favor of webkit2gtk-4.5 in hopes of syncing up with GTK 5 eventually. Probably pretty early to have it packaged in distros, but your call.

I don’t mind having it packaged now. We’re flexible enough that we can just drop the -5.0 package in favor of whatever name you decide upon.

Then please do less API refactoring.
We really really need a better solution for this. I want a Debian/Ubuntu “webkit2gtk4” package soon.

Not gonna happen. Once released, we have to maintain the API indefinitely, likely for 10+ years. Until then, we have a rare opportunity to fix things that we can’t fix in the GTK 3 version, which won’t come again for a long time. E.g. I want the sandbox to be enabled by default and mandatory, while it’s currently optional and disabled by default. I want to remove access to the original JS API in favor of the modern JSC API. There are lots of smaller improvements to make too.

If you expect it to be stable, you’re trying to get in too soon. If you want it sooner, help welcome. We’ll get there eventually…

Please remember that Discourse falls under the GNOME Code of Conduct, and that you’re expected to maintain a modicum of civility and respect towards everyone else.

If you cannot do this much, feel free to stop using this forum.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.