5 ms·
Webview: Tiny cross-platform webview library for C/C++
- disqard 2y agoDoes this contain a JS interpreter, or is it a cross-platform wrapper around OS-provided browser libraries?
- julesrms 2y agoThis is fine, but if you want something that does all this, but also: * is header-only * supports EDGE on Windows without the need to have the WebView2 SDK or to bundle a runtime DLL * supports fetch intercepting and some other customisation * is modern C++ rather than a sort of mashup of C/C++ then check out the one in the CHOC library here: https://github.com/Tracktion/choc/blob/main/gui/choc_WebView.h https://github.com/Tracktion/choc/blob/main/gui/choc_WebView...
- saurik 2y agoThis library is also header-only (look at the source file).
- bun_terminator 2y agoInteresting! The header as well as the entire library. Thanks
- wild_pointer 2y agoFrom the readme: > Internally, some absolutely hideous shenanegans are involved to make this possible! Yeah, like literally embedding a dll in the header file. Pretty cool, but seems kinda fragile.
- leni536 2y agoC++ programmers will do anything to avoid using a proper package manager. I say this as a C++ programmer.
- actionfromafar 2y agoSeconded.
- whizzter 2y agowhich one? :P
- julesrms 2y agoIt's totally fair to criticise it for being a horrible, ugly technique. But in terms of fragility, it's no worse than bundling the same DLL as a file along with your app. (In fact, it's less fragile than a loose DLL, because you don't run the risk of your DLL failing to install/being moved/accidentally loading some other random version of the same DLL etc)
- ninepoints 2y ago"header only" Aside from template based code, this is a disadvantage in my book usually
- deleted 2y ago[deleted]
- singularity2001 2y agoTogether with wasm / js this can give you super lightweight 'electron-like' standalone apps in less than 2 MB. Used as such in in https://github.com/pannous/wasp/ https://github.com/pannous/wasp/
- iainmerrick 2y agoOut of interest, why 2MB and not like 20KB, if it's using the OS's web view? (Depending on the complexity of the app, of course.) I realise 2MB is really small these days, I just found myself thinking "2MB wouldn't even fit on a floppy disk!"
- lf-non 2y agoPrimarily because it bundles a webserver to bridge the host code and code running in the browser.
- iainmerrick 2y agoWeb servers aren't big! Browsers are huge but servers can be tiny. I'm sure Caddy and nginx and the like are at least 2MB, but they have a lot of features. Googling around a bit for small web servers, I found this fun blog post: https://lipanski.com/posts/smallest-docker-image-static-website https://lipanski.com/posts/smallest-docker-image-static-webs... They ended up with a static web server in a 154KB Docker image.
- sublinear 2y ago> 2MB wouldn't even fit on a floppy disk! almost yeah https://en.wikipedia.org/wiki/2M_(DOS) https://en.wikipedia.org/wiki/2M_(DOS)
- Jyaif 2y ago> The goal of the project is to create a common HTML5 UI abstraction layer for the most widely used platforms. It would be great to have this library work on the two most popular platforms, ideally with as little Java on Android as possible.
- mrbluecoat 2y agoCool project, but you may want a more unique name to help with SEO and building a community. https://developer.android.com/reference/android/webkit/WebView https://developer.android.com/reference/android/webkit/WebVi...
- petabyt 2y agoI consider this the successor to webview: https://github.com/webui-dev/webui https://github.com/webui-dev/webui In general it should use less RAM and launch faster.
- cal85 2y agoFirst I've heard of WebUI, thanks. I had been looking at trying trying Tauri for an upcoming project - do you know about that and have any view on it? Interested in any opinions you have about tools in this space.
- c-hendricks 2y agoThese were some quirks / questions I was left with after playing around with it a few months ago, copied from a comment I made at the time: - (Auto) Updating. - Embedding other files (and actually distribute them). - Plugins (I guess plugins can be made for the various language bindings and implemented via event handlers). - Disabling Edge's annoyances (IE it looks like Edge's menu that shows up when selecting text is happening, I guess its image hover thing is there, and maybe more annoyances). - The menu on macOS is the menu of the launched browser. FWIW I maintain an app built with Tauri and generally really like it.
- petabyt 2y agoI hate to bash, but I would not recommend Tauri/webview to anybody. Here's my list of the problems: - For Windows, it requires the MS WebView2 runtime to be installed. It's installed by default in Windows 11, but Windows 10 users will need to make sure it's installed. (not sure if there's an error popup or anything?) There's no chance of running Tauri apps on Windows 7. - (For MacOS, it should work with no problems. NSWebView has been a thing for a very long time now.) - For Linux, packaging is a nightmare. Since Linux has no standardized webview (or UI framework), Tauri Linux apps have to be distributed as .deb packages which users need to install with dpkg (They might support .rpms other formats now, not sure). New users installing Linux Tauri apps will most likely have to install WebKitGTK (and possibly some other deps) for the first time (around 70mb). Either that or you can package your Tauri Linux app as an AppImage (I've seen a few Tauri apps do this), but that will include WebKitGTK in the final binary... and you end up with a binary that's on par or larger than Electron. Also, back when I was playing with and contributing to webview I did some RAM usage tests, and WebKitGTK actually did worse than Electron. We did briefly look into Netsurf or a 'lite' version of WebKit but RAM usage ended up being the same, and WebKitGTK3 was too popular and easy to use for the devs to want to switch to anything else. And finally for all platforms, you will probably be eating up a lot of RAM (and impacting launch times) by using WebView2/NSWebView/WebKitGTK, which is probably not the primary browser that most users use and have running and loaded into RAM. This should improve improve if you run more than 1 Tauri/electron app - but that seems unlikely to me. WebUI doesn't solve all of these problems (users must have a compatible web browser installed) and has some quirks, but it mostly solves the RAM usage issue (checks for what browser is already loaded, starts a new instance) and compiles into very small .AppImage/.app/.exe applications as users would expect. I would only recommend WebUI if you have a HTML/CSS/JS frontend that you absolutely can't depart with, or have some other scenario/limitation that forces you have to use a browser. Otherwise, it's so much better to just use a native framework :) (As a side note, Tauri used to use webview as a backend, but eventually switched to a rewrite.)
- novagameco 2y agoPet peeve: when people who haven't used Windows in 20 years write build instructions on Windows that still use the command prompt or just tell you to download MSYS or something
- ranger_danger 2y agoWhat would you prefer? I think VS and friends are a whole lot more bloated and annoying to use. For reference I have been developing on both platforms for 20 years.
- novagameco 2y agoCmake is pretty standard so windows users could just generate their own project files. But I mean not using .bat files or the command prompt like it's 2001. Powershell scripts are more common with Windows developers these days and is a far better syntax than batch files. But Visual Studio/MSBuild is the de facto way to compile code for MSVC (which the instructions use anyways, but bizarrely compiling the projects via CLI instead of MSBuild). The whole project just seems like it was written using 1990s build patterns. It doesn't even have a modern build system for linux, let alone windows
- saurik 2y ago> The whole project just seems like it was written using 1990s build patterns. It doesn't even have a modern build system for linux, let alone windows This project doesn't have a build system at all, nor should it: it is a single source file that you might add to your existing project and build using your build system... and even that source just includes the header, so presumably you wouldn't even do that and would just include the header from your existing code. It would be absolutely ridiculous for this header to have its own build system.
- badsectoracula 2y agoI've used Windows many times the last 20 years and i'd rather use MSYS2 to build a C/C++ program than MSVC as it allows me to use the exact same tools i'd prefer to use on Linux and macOS (...i don't really prefer to use macOS, but i can still use the same tools there too) than having Windows be its own special snowflake. And i find current MSVC incredibly bloated. I see in other comments you mentioned Powershell and CMake and TBH these are two things i avoided whenever i used Windows. CMake is used too much to be able to avoid it on Linux (which is currently my main OS) but it is not a tool i'd use myself if i had the choice. If i had to use a tool that generates build files, i'd rather use premake[0] as it is a self-contained binary with very simple Lua-based scripts (by default they look declarative but you can extend it as much as you want - i've even used a script to generate CMake files since these can be parsed by Qt Creator). The only downside is that on Unix systems it doesn't know concept of a shared library (can be "taught" with a custom script but it isn't something that is available out of the box). [0] https://premake.github.io/ https://premake.github.io/
- captaindiego 2y agoIs there some simple cross-platform way to have this sort of functionality, but rendering to an OpenGL or Vulkan texture?