Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook messenger checkbox plugin not rendering

I'm trying to implement the new Facebook Checkbox plugin in my aspx page but I can't get it showing on the screen. This error is happening at client side but Frame is hidden.

Error:

Refused to display 'https://www.facebook.com/v2.9/plugins/messenger_checkbox.php?allow_login=true&app_id=*******....' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors https://www.facebook.com"

What i have done so far :

 <script>
        window.fbAsyncInit = function () {
            FB.init({
                appId: '---MSGAPPID---',
                xfbml: true,
                version: 'v2.9'
            });

        };

        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) { return; }
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/en_US/sdk.js";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk')
        );
    </script>

 <div class="fb-messenger-checkbox"
        origin="---Orgin url ------"
        page_id="--Pagelivefacebookid--"
        messenger_app_id="--Mssgappid--"
        user_ref="randomnumber"
        prechecked="true"
        allow_login="true"
        size="large">
    </div>

Also, i have also white listed the domain but unfortunately not able to see it on my page. Suggest the best answer for get rid of this error

https://developers.facebook.com/docs/messenger-platform/messenger-profile/domain-whitelisting
like image 965
Raman Ghantiyala Avatar asked Nov 08 '22 20:11

Raman Ghantiyala


1 Answers

Errors I fixed to get this to work:

  1. Make sure the page is subscribed under the App Settings, under "Messenger Settings"

  2. Make sure "origin" is the URL of the page where you are trying to render this and NOT the URL for the fan page. I feel a bit dumb but I did make this mistake.

  3. Whitelist your domain to make sure you did not overwrite it. And get list of current white listed domains to make sure it is spelled correctly and that there is not a missing "www".

like image 158
Rene Banuelos Avatar answered Nov 14 '22 21:11

Rene Banuelos