created 2023-12-22 updated 2024-03-31 read 2 min

Multiple webview app in Tauri

#tauri

Multiple webviews in one window · Issue #2975 · tauri-apps/tauriIs your feature request related to a problem? Please describe. It seems like a fair amount of people want to be able to create browser-like apps in tauri, with multiple webviews. Describe the solut...github.com
A `BrowserView` that can be used to embed additional web content into `webview` window · Issue #2709 · tauri-apps/tauriDescribe the solution you'd like A BrowserView that can be used to embed additional web content into WebviewWindow like electrongithub.com

Well i can see that this sentence(s) might not be quite informative/understandable enough (i blame the language barrier(s) lol). But it's still the most important message here, iframe and shadow dom are more or less just given as a consolidation.

Anyway, there are 2 difficulties here:

BrowserView is not a native html tag and we can't really create new ones "native" enough for truly embedded webviews -> the custom html tags most browsers already supports is not enough here. Especially since those aren't enabled in webkit by default iirc...
it's pretty much impossible (or close enough to impossible) to embed a webview inside a webview, iirc Microsoft themselves mentioned that somewhere in the WebView2Feedback repo (obv that's windows only, but i expect webkit to be way worse here). What might be (more) possible are 2 webviews side by side in the same window but again, without the html tag.
The most important thing here is to keep in mind that tauri is not electron. Electron has control over the whole browser architecture and can change everything they want about/in it. Tauri basically just wraps around a "browser" (3 different at the same time btw) and has to interact/work with what's there. (that was badly phrased but i hope you understand what i mean)
So in short and simplified: Electron is a browser, tauri is a wrapper around one.

So in the end it's not like we don't want it, it's more like it's not really possible at least not in the way electron users want it or are used to. If anyone knows that it indeed is possible in a sane and cross-platform way, then i'd appreciate resources about that (or even better a PR 👼 )

Edit: I don't want to say that it's truly and absolutely 100% impossible, i definitely could be in the wrong here, but it would be a really big surprise to me ngl (mainly because i already invested a little bit of time in researching this).

refactor(core): add support to multiple webviews on a Tauri window by lucasfernog · Pull Request #8280 · tauri-apps/tauriWhat kind of change does this PR introduce? Bugfix Feature Docs New Binding issue #___ Code style update Refactor Build-related changes Other, please describe: Does this PR introduce a b...github.com