tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.49k stars 2.36k forks source link

[feat] Is there a way to allow window.open() on the front end? #10151

Open gusxodnjs opened 3 days ago

gusxodnjs commented 3 days ago

Describe the problem

The front end of my app is an external domain and contains a lot of code that opens a new window with window.open, but it doesn't work on the Tauri app.

I've seen this issue. However, it's a difficult situation to fix this window.open to webviewWindow. 😭

Is there any way to fix it on the Tauri app? thanks.

Describe the solution you'd like

Disable file download handler for Tauri (ex: disable_drag_drop_handler)

Alternatives considered

No response

Additional context

[✔] Environment
    - OS: Mac OS 13.5.2 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.79.0 (129f3b996 2024-06-10)
    ✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 18.17.0
    - yarn: 1.22.21
    - npm: 9.6.7

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 2.0.0-alpha.18
    - @tauri-apps/api [NPM]: 2.0.0-beta.13
    - @tauri-apps/cli [NPM]: 2.0.0-beta.10

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite
oukrims commented 2 days ago

I'm too having problem with permissions not working on runtime windows/webviews. I created a tauri command as a workaround `#[command] pub fn open_shell(app: tauri::AppHandle, url: String) { let aid: String = generate_random_string(5);

// app.shell().open(url, Some(Program::Chrome)).unwrap();

}`