C.W.K.
Stream
Lesson 04 of 06 · published

Window vs Webview: the 2.0 Split

~12 min · tauri, tauri-2, windows, webview

Level 0Web Tourist
0 XP0/56 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete
"A window is a frame. A webview is what's painted inside it. Tauri 2 finally lets them be separate things."

Two Concepts That Used to Be Fused

In Tauri 1, a 'window' and the web content inside it were effectively one object. Tauri 2 split them, because real apps sometimes need the distinction:

  • A Window is the native OS frame — title bar, borders, position, size, the thing that shows up in your taskbar. Tauri builds windows with a library called TAO.
  • A Webview is the rendering surface that paints your HTML. Tauri drives webviews with a library called WRY.

In Tauri 2 a single window can host multiple webviews (think split panes that are genuinely separate web contexts), or you can use the everyday convenience type that bundles one window with one webview.

The Type You'll Use 95% of the Time

That convenience type is WebviewWindow — one window, one webview, created together. Unless you're building something exotic like a tiling editor with independent web panes, WebviewWindow is what you reach for, and the rest of this quest mostly uses it. The deeper split (multiple webviews per window) is there when you need it; you won't be forced into the complexity to build a normal app.

Why You Should Care Now

Knowing the split saves you from a confusing day later. When you read Tauri 2 docs and see both Window and WebviewWindow APIs, you'll know which is which: Window is the bare frame, WebviewWindow is frame-plus-content. The windows track builds real multi-window UI on this foundation; this lesson is just so the vocabulary doesn't trip you.

Code

WebviewWindow — frame and content in one call·rust
// The everyday type: one window + one webview, made together.
// (Full window work lives in the `windows` track — this is just a taste.)
use tauri::WebviewWindowBuilder;
use tauri::WebviewUrl;

tauri::Builder::default()
    .setup(|app| {
        WebviewWindowBuilder::new(app, "main", WebviewUrl::default())
            .title("My App")
            .inner_size(1000.0, 700.0)
            .build()?;
        Ok(())
    });

External links

Exercise

Answer in your own words, no peeking: (1) If you want a second app window that shows a different route of your UI, do you need a new Window, a new Webview, or a new WebviewWindow? (2) When would you ever want two webviews inside ONE window? Write a one-line example use case for the second.
Hint
For (1): you want a whole new frame-plus-content, so it's the convenience type. For (2): think of a layout where two independent web pages must sit side by side in a single OS frame — like a dual-pane preview.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.