首页 > 解决方案 > 阻止 Ionic App iframe 中的浏览器选择器 - 阻止打开外部浏览器

问题描述

我在离子应用程序中使用 iframe 支付页面。单击 iframe 内的提交(发送)按钮后:

带有提交按钮的 iframe

带有浏览器的弹出窗口如下所示:

下一页

如何防止出现此弹出窗口?

targer="_self"在 iframe 中使用。但它不起作用。

标签: htmlionic-frameworkionic3

解决方案


我已经allow-popups allow-top-navigation从.sandboxiframe

修复前的 iframe:

<iframe #iframe id="iframe" 
        frameborder="0" 
        [src]="url"
        style="width:100%; border:none;" 
        sandbox="allow-popups allow-top-navigation allow-presentation allow-scripts allow-pointer-lock allow-same-origin allow-forms">
</iframe>

现在的 iframe:

<iframe #iframe id="iframe" 
        frameborder="0" 
        [src]="url"
        style="width:100%; border:none;" 
        sandbox="allow-presentation allow-scripts allow-pointer-lock allow-same-origin allow-forms">
</iframe>


推荐阅读