tauri: [bug] Anchor tag not opening link in default browser
Describe the bug
When I create an anchor tag with target=“_blank” and a href to some other domain and click on that anchor, the link does not get opened in the default browser but in a new tauri window.
Reproduction
The code base is in a private company repo, but I can share the code snippet. I use svelte if that is for relevance.
<a href={detailsViewedOptimization.learnMore} target="_blank">
<span class="underline">Learn more</span>
<Icon IconName="external-link" />
</a>
- Startup tauri
- Click on the link.
Expected behavior
The link should normally open in the default browser.
Platform and versions
Environment
› OS: Windows 10.0.22000 X64
› Webview2: 103.0.1264.62
› MSVC:
- Visual Studio Build Tools 2019
› Node.js: 16.13.2
› npm: 8.1.2
› pnpm: Not installed!
› yarn: 1.22.18
› rustup: 1.24.3
› rustc: 1.61.0
› cargo: 1.61.0
› Rust toolchain: stable-x86_64-pc-windows-msvc
Packages
› @tauri-apps/cli [NPM]: 1.0.0
› @tauri-apps/api [NPM]: 1.0.0-rc.5
› tauri [RUST]: 1.0.0,
› tauri-build [RUST]: 1.0.0,
› tao [RUST]: 0.11.2,
› wry [RUST]: 0.18.3,
App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:3000/
› framework: Svelte
App directory structure
├─ .git
├─ .github
├─ .vscode
├─ dist
├─ node_modules
├─ public
├─ src
└─ src-tauri
Stack trace
No response
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (7 by maintainers)
Here is my solution (vue)
Html
JavaScript
I found the best approach:
tauri = {version = "x.y z", features = [..., "shell-open"] }Hope that helps
This works for me ! ❤️❤️❤️