tauri-apps / tauri

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

[feat] Add support for `<base target="_blank">` #9167

Closed elijah-pl closed 7 months ago

elijah-pl commented 7 months ago

Describe the problem

Instead of making sure every single link has target="_blank", there is an option in HTML for setting the default target for all links. However, this feature does not seem to be supported - links are not opened in external browser.

Describe the solution you'd like

<base target="..."> tag should be respected and links should be opened in the external browser.

Alternatives considered

No response

Additional context

No response

amrbashir commented 7 months ago

can you provide tauri info this was implemented in https://github.com/tauri-apps/tauri/pull/7344

elijah-pl commented 7 months ago

@amrbashir

[✔] Environment
    - OS: Mac OS 12.7.3 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.76.0 (07dca489a 2024-02-04)
    ✔ cargo: 1.76.0 (c84b36747 2024-01-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 21.6.2
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.4
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.5.9 (outdated, latest: 1.5.11)

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:5881/
    - framework: React (Next.js)
    - bundler: Vite
elijah-pl commented 7 months ago

Checked on my Windows PC and it works as expected opens webpage in a new application window:

[✔️] Environment
    - OS: Windows 10.0.22631 X64
    ✔️ WebView2: 122.0.2365.80
    ✔️ MSVC: Visual Studio Community 2022
    ✔️ rustc: 1.72.0 (5680fa18f 2023-08-23)
    ✔️ cargo: 1.72.0 (103a7ff2e 2023-08-15)
    ✔️ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔️ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.16.0
    - npm: 9.5.1

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.4
    - tao [RUST]: 0.16.2
    - tauri-cli [RUST]: 2.0.0-alpha.9
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.5.9 (outdated, latest: 1.5.11)

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:5881/
    - framework: React (Next.js)
    - bundler: Vite
amrbashir commented 7 months ago

this feature was added in 1.5, and I see you have 1.4 in your Cargo.toml, try updating that version and run cargo update inside src-tauri