Facebook Connect – after login popup hangs in infinite loop

facebook

Symptom: After connect, a popup window opens and the user enters username + password. The popup turns blank and stays open.

There is no call to the login function (but a page refresh shows the cookies are set and the user is actually logged in).

I debugged the code and found that the xdcommReceiver.js file is stuck in an endless loop in the function dispatchMessage.

Further investigation shows that there is an exception happening in the line:

func = hostWindow.FB.XdComm.Server.singleton.onReceiverLoaded;

The exception is "Permission denied for http://www.example.org to get property Window.FB from http://example.org."

How do I solve it?

Additional information:

The site connect URL is http://www.example.org/
The page it happens on is in the format: http://www.example/org/folder/folder2/

Best Solution

This problem also happens when some JavaScript code changes the domain. For example, your page is in a.x.com. Then a script in the page does something like

<script>
    document.domain = "x.com";
<script>

Your domain is changed and this problem shows up.

Related Question