Take the 2-minute tour ×

I am adding Facebook login to my existing asp.net application. I have added a Facebook login button to my login screen. Now, I click Facebook's login button and in IE 9 it throws client-side exception in all.js on Line 22: if(a.params)b.fbCallID=a.id;

Even after that exception I see the Facebook login screen and can log in, and in the main browser window I get the auth.login event, so I can live with that.

But, if I am already logged in to Facebook, I come to the page and click Facebook login button, I briefly see the empty popup window, then I get teh same client-side exception, and then I get no event in the main browser window, so I don't know if the user logged in so I can't redirect them to another page.

I tried the channelUrl trick but it didn't help.

Any suggestions what's going on?

share|improve this question
possible duplicate of Permission denied error in all.js –  a paid nerd Sep 19 '11 at 1:14

2 Answers 2

up vote 2 down vote accepted

I found this hack that fixed the issue for me; add this line right after you call FB.init():

// Hack to fix http://bugs.developers.facebook.net/show_bug.cgi?id=20168 for IE7/8/9
FB.UIServer.setLoadedNode = function (a, b) {
                                FB.UIServer._loadedNodes[a.id] = b;
share|improve this answer

The reason it is happening (from the websites and documents I have read, and believe me, I've read a LOT) is that IE refuses cross-site javascript, and it sees the all.js as crossing the sandbox border. A good discussion can be found here.

Some people say that adding the channel.html file works, but we have tried all flavors of that, and have not had any success. (Remember that the http or https must match the page sending the request.)

Microsoft makes reference to this same issue and their advice is to add the site to trusted sites (that doesn't help). Old advice (from last year) is to add CP="HONK" as your compact privacy policy, but I think that bug was fixed, and it was cookie-related.

What seems to be happening to us is that the login actually continues, and the callback gets called properly, but the main thread that should complete outside of the login call stops executing (because of the error). So, any functions outside the login fail to execute after the login call.

If anyone has a way to get IE to not throw the exception or to create a workaround for this issue, I am desperate to have it. Any info needed I will be happy to provide, but a sample is here:

enter code here
code before login here...
   callback stuff here... This part fires.
main thread stuff here...  This fails because of permission denied error.
share|improve this answer
What do you mean when referencing "main thread"? JS is single-threaded, and it might stop executing code if it hits a certain error. –  Andrey Sep 9 '11 at 15:08
Actually, I think I might be onto something - I am now using only onlogin event of the facebook login button, and it seems to work ok for both cases when the user is already logged in to FB and when not. I still get the "Permission denied" exception but it doesn't stop the functionality. I'll post the solution here once it's tested and I make sure it's working. –  Andrey Sep 9 '11 at 15:10
Javascript isn't multithreaded as such, but callbacks mimic multithreading in some ways. The execution of what I call the "main thread" (what comes after the FB.Login call) is being halted, but yet the callback runs to completion. I am not sure why, but we have verified this with alerts in the code. –  MontyThreeCard Sep 9 '11 at 15:44
I think that FB.login is throwing an error AFTER it registers the callback, so it's halting execution of the current code path, but since the callback is async, it fires as normal when the XHR request returns –  Jiaaro Sep 9 '11 at 15:49

Your Answer


