开发者

Facebook Connect / Graph - problems in Internet Explorer with fb:login dialog (not closing)

I am trying to get the facebook connect stuff working on my localhost. In FireFox and Chrome it works perfectly. In Internet Explorer:

  • an error appears in the connect dialog. This is:

    Invalid Argument The Facebook Connect cross-domain receiver URL (http://static.ak.fbcdn.net/connect/xd_proxy.php#?=&cb=f1e33405f2824e9&origin=http%3A%2F%2Flocalhost%2Ff78888c44d2c37&relation=opener&transport=flash&frame=f144cb110fc0cc&result=xxRESULTTOKENxx) must have the application's Connect URL (http://localhost:8080/) as a prefix. You can configure the Connect URL in the Application Settings Editor.

  • when the authentication succeeds Internet Explorer redirects in the popup to a page on localhost i.e. my facebook connect URL. With Chrome and Firefox it closes the popup and allows the handler to reload the page.

This is very frustrating, as the behaviour in Chrome and Firefox is perfect. Please can you provide some advice - I really am stuck with this. My HTML code is below:

<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:fb="http://www.facebook.com/2008/fbml"
xml:lang="en" lang="en">

<fb:login-button></fb:login-button>


<div id="fb-root"></div>
        <script src="http://connect.facebook.net/en_US/all.js"></scr开发者_C百科ipt>
        <script>
        FB.init({appId: 'MY_APP_ID', status: true, cookie: true,xfbml: true});
        FB.Event.subscribe('auth.login', function(response) {
                window.location.reload();
            });


        </script>

Thank you.


I think this is a bug in the facebook javascript (details in the forum post).

I found a workaround: Using http://127.0.0.1:8080/ in the browser instead of http://localhost:8080/ appears to work in all three of Internet Explorer, Firefox and Chrome.


Just in case other people stumble here and don't catch this in OP's code, this worked after I added the xmlns:fb attribute to my html open node:

<html xmlns:fb="http://www.facebook.com/2008/fbml">


Thanks to the Facebook developer forum, I have my answer. This strange behaviour is caused by using a port number in the Facebook Connect URL i.e. not the standard port 80 which doesn't need specifying in your URL.

The full answer is here:

http://forum.developers.facebook.com/viewtopic.php?pid=232589


Also, make sure this tag is right after your body tag: <div id="fb-root">


As Saxon Druce pointed out, the answer marked correct no longer works. I was able to solve my issues with the Fb.login() popup window in IE11 running on localhost by doing two things (I am using visual studio 2013):

1) Run VS 2013 as an Admin and, in solution properties, change the project url to: http://localhost/ 2) Reflect the url change in your Facebook app settings in the developer portal

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜