[shell] v2: no way to turn off the injected link handler, which blocks opener on _blank links
Maintainers usually reply within 3 days
Nobody has claimed this yet.
- #3755 by @Sealdot — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, rust, tauri
Research direction
Start by reading init-iife.js and the shell plugin's Builder, comparing its link handling with opener's Builder::open_js_links_on_click. The issue describes two possible fixes but does not choose between them, so clarify the intended behavior before making a change. Done means shell no longer blocks links handled by opener or by an app's own click handler.
Written by the indexing model from the issue text.
Description
Describe the bug
On v2, tauri-plugin-shell always injects init-iife.js, which listens for clicks on <body> and sends every external <a target="_blank"> link to plugin:shell|open. There is no way to turn it off, unlike opener's Builder::open_js_links_on_click.
An app that registers both plugins and grants only opener:*, as the docs now recommend for opening links, gets dead links:
- shell's listener runs first, calls
preventDefault()and invokesshell.open, which rejects withshell.open not allowed; - opener's listener on
windowthen returns early, because the click was already prevented.
shell's script also ignores defaultPrevented, so a link that handles its own click (for example to ask before opening) still gets sent to shell.open.
#3744 removes the script on v3, where open is gone, and describes the same interaction. On v2 the command still exists, so the script stays, but apps that only use shell for Command have no way to opt out.
Reproduction
- Register
tauri_plugin_shell::init()andtauri_plugin_opener::init(). - Grant
opener:defaultandshell:allow-spawn, but notshell:allow-open. - Click
<a href="https://tauri.app" target="_blank">.
Nothing opens, and the console shows shell.open not allowed.
Expected behavior
One of:
- a shell
Builderoption to skip the link script, matching opener'sopen_js_links_on_click; - or, at least, the script returns early when
event.defaultPreventedis set, as opener's does.
Today we work around it with a capture-phase listener that stops the click on the link before it reaches <body>.
Platform and versions
tauri 2, tauri-plugin-shell 2.4.0, tauri-plugin-opener 2.7.0, macOS. The script is unchanged on the v2 branch.
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 637
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 36
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tauri-apps/plugins-workspace
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
tauri-apps/plugins-workspace#3780 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
tauri-apps/plugins-workspace#3770 ·
Maintainers usually reply within 3 days
-
[notification] init script fires IPC on about:blank → 500 'Origin header is not a valid URL' on Linux (WebKitGTK)May be free again A pull request for this issue was closed without being merged. Openplatform: linux plugin: notification type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
tauri-apps/plugins-workspace#3562 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
tauri-apps/plugins-workspace#3543 ·
Maintainers usually reply within 3 days
-
platform: ios plugin: notification type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
tauri-apps/plugins-workspace#3533 ·
Maintainers usually reply within 3 days
All issues in tauri-apps/plugins-workspace
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/spark-local-inference#268 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
datafusion-contrib/StreamFusion#653 ·
Maintainers usually reply within 1 day
-
bug CLI exec session
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tursodatabase/turso#11734 ·
Maintainers usually reply within 1 day