检测“拒绝显示文档的方法,因为X-Frame-Options禁止显示”。错误? [英] Way to detect "Refused to display document because display forbidden by X-Frame-Options." error?

查看:159
本文介绍了检测“拒绝显示文档的方法,因为X-Frame-Options禁止显示”。错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用'google viewer'查看一些文档。
唯一的问题是,如果浏览器有一个处于不明朗状态的google-login,它什么也没有显示,并且拒绝显示文档,因为X-Frame-Options禁止显示。发生错误并显示在控制台中。

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.

limbo的意思是当登录已知但用户必须重新输入密码以重新验证自己时。

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?

提前致谢。

推荐答案

遇到同样的问题,找到的唯一解决办法是检查 iframe 一段时间后完成加载:

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);
});

实际上,批准我的应用的用户现在自动在<$ c $内登录C> IFRAME 。

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

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

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

这篇关于检测“拒绝显示文档的方法,因为X-Frame-Options禁止显示”。错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆