Skip to content

Links are not opened if xterm.js if inside an iframe on safari.  #3634

Closed
@BigDwarf

Description

@BigDwarf

Links are not opened if xterm.js is inside an iframe on safari.
window doesn't open

Details

  • Safari Version 14.1.1 (16611.2.7.1.4)
  • Mac OS Big Sur, Version 1.4 (20F71):
  • "xterm": "4.16.0",
    "xterm-addon-web-links": "0.5.0"

Steps to reproduce

  1. Install xterm-addon-web-links extension
  2. Open xterm.js instance in an iframe
  3. Set permissions to an iframe to allow popups and scripts: sandbox="allow-top-navigation-by-user-activation allow-popups allow-popups-to-escape-sandbox allow-scripts"
  4. Type any website name, f.e https://google.com
  5. Hover and click on the link above

This is caused by setting window.opener = null

. What is the value of opening a windows and setting URL separately? It could be smth like this (i anyway don't need a window without a URL opened).

function handleLink(event: MouseEvent, uri: string): void {
    try {
      window.open(uri, 'noopener');
    } catch (error){
      console.warn('Opening link blocked due to: ', error);
    }
} 

Minimalistic example to reproduce same behaviour without xterm.js:

index.html

<!DOCTYPE html>
<html>
<body>
  <button onclick="newWindow = window.open(); newWindow.opener = null; newWindow.location.href='https://google.com' ">Button doesn't open a URL</button>
  <button onclick="window.open('https://google.com', 'noopener')">Button opens a URL</button>
</body>
</html>

iframe.html

<!DOCTYPE html>
<html>
<body>
<iframe
        src="index.html"
        sandbox="allow-top-navigation-by-user-activation allow-popups allow-popups-to-escape-sandbox allow-scripts">
</iframe>
</body>
</html>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions