Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to detect "Refused to display document because display forbidden by X-Frame-Options." error? [duplicate]

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.

like image 613
Mr Meow Avatar asked Feb 02 '12 02:02

Mr Meow


1 Answers

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

like image 155
DusanV Avatar answered Oct 25 '22 21:10

DusanV