Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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%2Fmysiteurl.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?

Update (2010 Sep 10):

This problem is not universal. My site url has a port number in it, because it's my test site: http://mysiteurl.com:12345. Without a port number, ie8 seems to be ok. With the port number, it continues to fail as it did before. However, the error message is now more terse:

Invalid Argument

Given URL is not allowed by the Application configuration

Also, this problem is specific to IE (actually, I suspect it's specific to the flash XD transport, but I don't know how to confirm that). It works fine on every other platform/browser pair I've tried.

I am still no closer to making this work with a url with a port number.

like image 698
archbishop Avatar asked Jun 09 '10 04:06

archbishop


1 Answers

Try passing channelUrl param to your FB.init function and create channel.html file as suggested by ref link below:

https://developers.facebook.com/docs/reference/javascript/

like image 159
Abdo Avatar answered Nov 16 '22 04:11

Abdo