Skip to content

[bug] webview.delete_cookie not working #14651

@AlloryDante

Description

@AlloryDante

Describe the bug

I tried to clear previous session of a remote website (roblox.com) using a command:

#[tauri::command]
async fn delete_session(window: tauri::WebviewWindow) {
  
    let cookies = window.cookies().unwrap();
    for cookie in cookies {
            println!("{:?}", cookie);
            let webview = window.get_webview_window("main").unwrap();
            webview.delete_cookie(cookie).unwrap(); 
            println!("Deleted cookie");
       
    }


    window.eval("window.location.replace('https://www.roblox.com/')").unwrap();
}

I used the window.TAURI.core.invoke("delete_session") to execute the command.

In the tauri console I can see bunch of cookies getiing deleted but they are still present when the the page navigates to the website.

In case there is needed here is my main script:

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_store::Builder::new().build())
        .plugin(tauri_plugin_http::init())
        .invoke_handler(tauri::generate_handler![
            add_roblox_account, 
            notify_login_success,
            handle_roblox_account,
            delete_session
        ])
        .setup(|app| {
            let window = app.get_webview_window("main").unwrap();
            let webviews = app.webview_windows();
            Ok(())
        })
        .run(tauri::generate_context!())
        .expect("error running tauri app");
}

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 x86_64 (X64)
    ✔ WebView2: 143.0.3650.80
    ✔ MSVC:
        - Visual Studio Build Tools 2022
        - Visual Studio Community 2022
    ✔ rustc: 1.84.0 (9fc6b4312 2025-01-07)
    ✔ cargo: 1.84.0 (66221abde 2024-11-19)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 22.17.0
    - pnpm: 10.8.1
    - npm: 10.9.2
    - bun: 1.1.36

[-] Packages
    - tauri 🦀: git+https://github.com/tauri-apps/tauri?branch=dev#1573c72402352949d1fd3ca5c6fdbee46fe69fbb (2.9.3), (outdated, latest: 2.9.5)
    - tauri-build 🦀: git+https://github.com/tauri-apps/tauri?branch=dev#1573c72402352949d1fd3ca5c6fdbee46fe69fbb (2.5.2), (outdated, latest: 2.5.3)
    - wry 🦀: 0.53.5
    - tao 🦀: 0.34.5
    - @tauri-apps/api  ⱼₛ: 2.9.0 (outdated, latest: 2.9.1)
    - @tauri-apps/cli  ⱼₛ: 2.9.4 (outdated, latest: 2.9.6)

[-] Plugins
    - tauri-plugin-store 🦀: git+https://github.com/tauri-apps/plugins-workspace?branch=v2#f2d4abb9e2bb98a0281d8f9788a72c07333b46cc (2.4.1)
    - @tauri-apps/plugin-store  ⱼₛ: 2.4.1
    - tauri-plugin-http 🦀: git+https://github.com/tauri-apps/plugins-workspace?branch=v2#f2d4abb9e2bb98a0281d8f9788a72c07333b46cc (2.5.4)
    - @tauri-apps/plugin-http  ⱼₛ: 2.5.4
    - tauri-plugin-fs 🦀: git+https://github.com/tauri-apps/plugins-workspace?branch=v2#f2d4abb9e2bb98a0281d8f9788a72c07333b46cc (2.4.4)
    - @tauri-apps/plugin-fs  ⱼₛ: not installed!
    - tauri-plugin-log 🦀: git+https://github.com/tauri-apps/plugins-workspace?branch=v2#f2d4abb9e2bb98a0281d8f9788a72c07333b46cc (2.7.1)
    - @tauri-apps/plugin-log  ⱼₛ: not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:5173/
    - framework: Svelte
    - bundler: Vite

Stack trace


Additional context

I want to be able to delete the previous session from a remote website (delete the cookies).

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: Windowsstatus: upstreamThis issue is blocked by upstream dependencies and we need to wait or contribute upstream fixestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions