Monday 26 September 2011

Facebook Javascript SDK: Security error "Permission denied" in IE while login

Facebook platform is really not friendly with IEs browsers and I'm sure that a lot of developers have many difficulties in IE while working with Facebook. Recently I've faced a troubles in IE7 and IE8 while calling method FB.login(); Authentication popup appears but after that security error popup is shown with text like:
Message: Permission denied
Line: 22
Char: 4250
Code: 0
URI: https://connect.facebook.net/en_US/all.js
In other browsers everything works fine. There is a hack that allows to avoid this error in IE. It is necessary to add some piece of code after calling FB.init() on client side:
  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; 
  };
The trouble is described in Facebook Bugzilla: http://bugs.developers.facebook.net/show_bug.cgi?id=20168 Hope, it will be fixed by Facebook soon.