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

我怕爱的太早我们不能终老 提交于 2019-12-18 03:49:21

问题


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.


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/23555592/refused-to-display-in-a-frame-because-it-set-x-frame-options-to-deny-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!