Refused to display in a frame because it set 'X-Frame-Options' to DENY facebook fb.ui share method
Asked Answered
S

6

33

Receiving this message in the console: Refused to display in a frame because it set 'X-Frame-Options' to DENY

This happens when the site is being shown in the mobile version, its just a different set of html and assets served up if the user agent is a mobile device.

It does display m.facebook.com in the console error message.

FB.ui(
{
    method: 'share',
    href: 'https://www.espn.com/mlb',
},
    function(response) {
        if (response && !response.error_code) {
          console.log('shared_post');
          //facebook_post_to_fanpage(access_token_data, link_id, song);
          return true;
        } else {
          return false;
        }
    }
);      

I am able to use the FB.api on the mobile version of the site, as well as login and getauth without any problem, but it gives me fits when I try to use FB.ui, both the share and feed methods.

I figured I'd be in the clear if I was using the facebook javascript sdk.

Stele answered 9/5, 2014 at 2:11 Comment(3)
Which version of the Facebook API are you using? Available version numbers are found in the Facebook API changelog. You can specify a version number in your call to FB.init().Orten
2.0. I think the problem was, I was calling FB.login when I should of used the function that checks their current status, if they're not connected, then fire the login function. I think I was calling login and trying to fire the fb.ui feed/share dialog at the sametime.Stele
possible duplicate of Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'Vogt
M
33

I got my solution from this post: Loading Iframe Facebook (Load denied by X-Frame-Options)

I got the same issue, and it got fixed, when i used target="_top" for the link , and it is now working perfectly.

Maladminister answered 1/10, 2014 at 14:19 Comment(0)
V
6

You must allow your mobile app domain in the FB developers dash. I had this issue with FB.ui - 'share' when the user wasn't logged into FB.

I found this video quite helpful : https://www.youtube.com/watch?v=7CNpLgwa0-c

Venepuncture answered 12/5, 2015 at 16:28 Comment(0)
G
3

I am not sure it is recent actual but in angular 8 I have faced the same problem with Send dialog.

In my case the solution was: added display: 'popup' to FB.ui{...}.

Goffer answered 29/4, 2020 at 15:44 Comment(0)
P
2

This has happened on our sites before when a Mac user has Kaspersky Security Cloud installed. The anti-virus is somehow interfering with the Facebook iframe load and causes it to stall indefinitely, throwing the error Refused to display https://www.facebook.com... in a frame because it set X-Frame-Options to 'deny'

Disabling Kaspersky and refreshing browser solved it for the user having the issue.

Puerperium answered 12/2, 2019 at 21:5 Comment(0)
D
0

It could be that one or some of the shared content in FB is video.

You may consider either hide it or change the URL of video with embed type.

Dempster answered 13/5, 2018 at 4:1 Comment(0)
K
0

I had similar issues with comments plugin.

The following stesp helped.

Created an app in Facebook.

Added the website to domain App domains.

Select the app when you generate the code for the plugin. Now it works fine

Example: https://www.staffcorner.com/view.html?id=6260518381682688

Kubis answered 15/9, 2023 at 17:7 Comment(2)
When asking a question, provide us with more details about your question with a reproducible code snippet so that other members can benefit from your question.Facia
@RamonSoarez this isnt a question, its an attempt towards an answer..Othello

© 2022 - 2024 — McMap. All rights reserved.