cmd/tsconnect: fix xterm.js link opening not working when rendered into another window

The default WebLinksAddon handler uses window.open(), but that gets blocked
by the popup blocker when the event being handled is another window. We
instead need to invoke open() on the window that the event was triggered
in.

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
pull/5605/head
Mihai Parparita 2 years ago committed by Mihai Parparita
parent f03a63910d
commit 11fcc3a7b0

@ -23,7 +23,9 @@ export function runSSHSession(
term.open(termContainerNode) term.open(termContainerNode)
fitAddon.fit() fitAddon.fit()
const webLinksAddon = new WebLinksAddon() const webLinksAddon = new WebLinksAddon((event, uri) =>
event.view?.open(uri, "_blank", "noopener")
)
term.loadAddon(webLinksAddon) term.loadAddon(webLinksAddon)
let onDataHook: ((data: string) => void) | undefined let onDataHook: ((data: string) => void) | undefined

Loading…
Cancel
Save