How can I get the new Facebook Javascript SDK to work in IE8?

Posted by archbishop on Stack Overflow See other posts from Stack Overflow or by archbishop
Published on 2010-06-09T04:06:53Z Indexed on 2010/06/09 4:12 UTC
Read the original article Hit count: 684

Filed under:
|

I've boiled down my page to the simplest possible thing, and it still doesn't work in IE8.

Here's the entire html page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
<head></head>
<body>
<div id="fb-root"></div>
<fb:login-button></fb:login-button>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({appId: 'd663755ef4dd07c246e047ea97b44d6a', status: true, cookie: true, xfbml: true});
  FB.Event.subscribe('auth.sessionChange', function(response) {
    alert(JSON.stringify(response));
  });
  FB.getLoginStatus(function (response) { alert(JSON.stringify(response)); });
</script>
</body>
</html>

In firefox, safari, and chrome (on a mac), I get the behavior I expect: if I am not logged into Facebook, I get a dialog on page load with an empty session. When I click the Login button and log in, I get a second dialog with a session. If I am logged into Facebook, I get two dialogs with sessions: one from the getLoginStatus call, and another from the event.

In IE8, I get no dialogs when I load the page. The getLoginStatus callback is not invoked. When I click the Login button, I get a dialog, but it has a very strange error in it:

Invalid Argument

The Facebook Connect cross-domain receiver URL (http://static.ak.fbcdn.net/connect/xd_proxy.php#?=&cb=f3e91da434653f2&origin=http%3A%2F%2Fsword.sqprod.com%2Ff210cba91f2a6d4&relation=opener&transport=flash&frame=f27aa957225164&result=xxRESULTTOKENxx) must have the application's Connect URL (http://mysiteurl.com/) as a prefix. You can configure the Connect URL in the Application Settings Editor.

I've sanitized the Connect URL above, but it is correct.

The dialog does have username/password fields. If I log in, the dialog box gets redirected to my Connect URL, but there's no fb cookie, so of course nothing works.

What am I doing wrong here?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about facebook