重定向后,iframe #document 在 iframe 之外加载

After redirecting, the iframe #document loads outside the iframe

目前,我的网页正在加载一个使用 ws-federation 进行身份验证的 iframe,然后它会重定向到想要的 iframe 网页。

问题发生在第一次加载和证书时,因为在绕过证书后,iframe 正确地加载了网页,但他的#document 出现在父级的 top-0 left-0。

好的,找到解决方案了。

当 Iframe 进行重定向时,它没有显示 (display: none),当它最终加载所需的网页时(重定向后),显示属性已更改 (display: block).

这导致 Iframe 的#document 出现在 top-0 left-0(因为显示使元素不带 space)。所以,只需将显示 属性 更改为 visibility: hiddenvisibility: visible,现在它完美无缺!