tauri-apps / tauri

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

[bug] Anchors with target="_blank" inside of an iframe are not working #9912

Open toppermitz opened 4 months ago

toppermitz commented 4 months ago

Describe the bug

If I have a anchor with target="_blank" inside an iframe nothing happen when I click.

anchors outside iframe open in a normal way (new page on my default browser)

Reproduction

I make a small repo to reproce this bug

https://github.com/toppermitz/tauri-iframe-bug

Just click on link inside the iframe and nothing happen.

Expected behavior

When I click in an anchor inside an iframe, the anchor href must be loaded on my default browser.

Full tauri info output

1.6.7

[✔] Environment
    - OS: Mac OS 14.5.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.12.0
    - pnpm: 9.1.3
    - yarn: 1.22.19
    - npm: 10.5.0
    - bun: 1.0.17

[-] Packages
    - tauri [RUST]: 1.6.7
    - tauri-build [RUST]: 1.5.2
    - wry [RUST]: 0.24.10
    - tao [RUST]: 0.16.9
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 1.5.14

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../src
    - devPath: ../src

For 2.0.0-beta.22

[✔] Environment
    - OS: Mac OS 14.5.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.12.0
    - pnpm: 9.1.3
    - yarn: 1.22.19
    - npm: 10.5.0
    - bun: 1.0.17

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.0
    - tao [RUST]: 0.28.0
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.19

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../src

Stack trace

No response

Additional context

This problem occours in 1.6.7 and 2.0-beta version

AcrylicShrimp commented 3 months ago

Have you checked permissions? Since tauri v2, you must provide permissions via capabilities.

In the src-tauri/capabilities/xxx.json:

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "application-capability",
  "description": "Capability for the application",
  "windows": ["*"],
  "permissions": ["shell:allow-open"]
}
toppermitz commented 3 months ago

I double check the permissions .

if you check my demo project the permission is granted but inside an iframe nothing happen