且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

带有`target =" _blank"`的沙盒iFrame无法打开新选项卡或窗口

更新时间:2022-02-10 08:50:15

显然,Chrome允许使用名为 allow-popups 。该属性在Firefox中也受支持,并且是 W3C

Apparently Chrome allows an undocumented sandbox property called allow-popups to be set. The property is also supported in Firefox and is a Candidate Recommendation on W3C.

allow-popups 让沙盒框架在新窗口或标签中打开链接并且,看起来,当框架尝试打开 target =_ top的链接时,浏览器将在新选项卡或窗口中打开URL。

allow-popups lets the sandboxed frame open links in new windows or tabs and, it appears, when the frame tries to open a link with target="_top" the browser will open the URL in a new tab or window.