检测“由于 X-Frame-Options 禁止显示而拒绝显示文档”的方法。错误?

发布于 2025-01-01 18:08:39 字数 231 浏览 3 评论 0原文

我正在使用“谷歌查看器”来查看一些文档。 唯一的问题是,如果浏览器的 google 登录处于“limbo”状态,则不会显示任何内容,并且“拒绝显示文档,因为 X-Frame-Options 禁止显示”。发生错误并显示在控制台中。

我所说的“limbo”是指已知登录信息但用户必须重新输入密码才能重新验证自己的情况。

有没有一种方法可以检测何时发生此错误,以便我可以显示弹出错误来通知用户?

提前致谢。

I am using 'google viewer' to view some documents.
Only problem is, if the browser has a google-login that is in "limbo" it shows nothing and the "Refused to display document because display forbidden by X-Frame-Options." error occurs and is shown in the console.

What I mean by "limbo" is when a login is known but the user has to re-enter their password to reverify themselves.

Is there a method to detect when this error occurs so I can display a popup error to notify the user?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如梦初醒的夏天 2025-01-08 18:08:39

遇到了同样的问题,找到的唯一解决方案是检查 iframe 是否在一段时间后完成加载:

$(function () {
    $('#DtLoadingIframe').on('load', (function () {
        clearTimeout(errloading);
    }));

    var errloading = setTimeout(function () {
        window.location = "App.aspx";
    }, 5000);
});

所以实际上,批准我的应用程序的用户现在“自动”在 iframe 中登录代码>.

其他人会在 5 秒后重定向(对于这 5 秒,我有一些小文字解释了情况)。

也许使用这种方法可以做得更好?

http://static.jtwb.dotcloud.com/测试用例/html/content-disposition-attachment.html

Had a same problem and the only solution found was to check if iframe finished loading after some time:

$(function () {
    $('#DtLoadingIframe').on('load', (function () {
        clearTimeout(errloading);
    }));

    var errloading = setTimeout(function () {
        window.location = "App.aspx";
    }, 5000);
});

So actually, users that approved my app, are now "automatically" signed in within iframe.

Others are redirected after 5 seconds (for those 5 seconds I have some small text explaining the situation).

Perhaps it could be done better by using this approach?

http://static.jtwb.dotcloud.com/test-cases/html/content-disposition-attachment.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文