We are getting a permission denied error in IE8. f

2019-07-31 02:15发布

问题:

We are getting a permission denied error in IE8. It happens after the FB.init. We have tried the channelUrl fix. We have put the as the first tag after the body. We have tried the document.domain in both the script and in the channel.html. We have tried the FB.UIServer.setActiveNode workaround. It works fine in IE9, FF, Chrome and Safari.

<div id="fb-root"></div>
  <script src="//connect.facebook.net/en_US/all.js"></script>
  <script type="text/javascript">
          var myUserId;
          document.domain = 'XXXX.XXXX.com';

          window.fbAsyncInit = function() {
              FB.init({ appId: 'XXXXXXXXX',
                  status: true,`enter code here`
                  cookie: true,
                  xfbml: true,
                  channelUrl: 'http://XXX.XXXX.com/channel.html'
              });
              FB.UIServer.setActiveNode = function(a, b) { FB.UIServer._active[a.id] = b; } // IE hack to correct FB bug

I am getting an permission denied error in IE8 in a facebook-iframe for a tab app on a facebook-fanpage. Any ideas how to fix this?

回答1:

This worked for me:

FB.init({
    appId:        'xxxxx',
    appSecret:    'xxxxxxxxx',
    status:        true
    cookie:        true
});

// this code solves the issue
  FB.UIServer.setLoadedNode = function (a, b) { 
  FB.UIServer._loadedNodes[a.id] = b; 
};

As seen here http://ikorolchuk.blogspot.com/2011/09/facebook-javascript-sdk-security-error.html?showComment=1323866805727#c7681567069563597438



回答2:

I'd suggest attaching the debugger and posting exactly where the error occurs. If its related the Facebook Proxy it might be a temporary issue with Facebook.

A couple of suggestions ( not mentioned above ):

1/ Try adding FBML to your html tag:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en">

2/ Try disabling compatibility mode options if your are accessing a test server that might be considered an intranet site ( generally same subnet ).



回答3:

It is possibly because you redirect to a HTTP page while your current iframe is https.

The protocol of the iframe can be https, maybe because of an internal redirect, even if the Facebook page is http.