Facebook Authentication - Unsafe JavaScript attempt to access frame with URL

后端 未结 7 1163
别那么骄傲
别那么骄傲 2021-01-11 20:14

I am trying to implement Facebook Login System into my website.

While it try to connect to facebook, I get an error from console log:

Unsafe JavaScri         


        
相关标签:
7条回答
  • 2021-01-11 20:50

    In my case error was caused by like widget that was loaded using addthis on the site that already had FB app.

    It looked like problem was in conflicting with multiple fb js-sdk.

    So solution could be replace addthis facebook like wdiget by native facebook like widget.

    I've also had another bug in webkit when js-sdk was not loaded. I fixed that by replacing window.fbAsyncInit by jQuery.getScript(). Eventually it fixed error "Unsafe JavaScript attempt to access frame with URL" also.

    Here is example:

    $.ajaxSetup({ cache: true });
    $.getScript('//connect.facebook.net/en_UK/all.js', function() {
      FB.init({
        appId: 'your app id',
        cookie: true,
        xfbml: true,
        oauth: true,
        status: true
      });
      // Trigger custom event so we can use it to run init dependent actions in different places.
      $(document).trigger('FBSDKLoaded');
      //...
    });
    
    0 讨论(0)
提交回复
热议问题