Skip to content

feat: expose wry permission handler API #14753

@F0RLE

Description

@F0RLE

Is your feature request related to a problem? Please describe.

Currently, Tauri applications (especially on Windows/WebView2) show native permission prompts for capabilities like Microphone and Camera. For kiosk applications or embedded systems where user interaction is limited, we need a way to automatically grant these permissions without prompting the user.

Describe the solution you'd like

Since wry has recently added a with_permission_handler API (supported in tauri-apps/wry#1656), I would like to see this exposed in Tauri.

Ideally, we could configure a handler in WebviewWindowBuilder similar to how navigation_handler is exposed:

tauri::Builder::default()
  .setup(|app| {
    let window = tauri::WebviewWindowBuilder::new(app, "main", tauri::WebviewUrl::default())
      .permission_handler(|kind| {
        match kind {
           // Allow microphone access without prompt
           tauri::PermissionKind::Microphone => tauri::PermissionResponse::Allow,
           _ => tauri::PermissionResponse::Default,
        }
      })
      .build()?;
    Ok(())
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions