Reputation: 9969
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.
rel
attributeUpvotes: 1
Views: 630
Reputation: 9969
according to MDN documentation: iframe, the sandbox
attribute needs to set to allow-popups
:
Allows popups (such as
window.open()
,target="_blank"
, orshowModalDialog()
). If this keyword is not used, the popup will silently fail to open.
Upvotes: 2