Given src.html:

<html>
<body>
<p>
  <a href="https://stackoverflow.com" target="_blank" rel="noopener noreferrer">StackOverflow</a>
</p>
</body>
</html>

and iframe.html

<html>
<head>
  <title>Test iframe</title>
</head>
<body>

  <iframe sandbox="allow-scripts" src="src.html">
  </iframe>

</body>
</html>

When I click StackOverflow link, it cannot open on a new tab.


1 Answers

2
Juanito Fatas On

according to MDN documentation: iframe, the sandbox attribute needs to set to allow-popups:

Allows popups (such as window.open(), target="_blank", or showModalDialog()). If this keyword is not used, the popup will silently fail to open.