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

▼魔方 西西 提交于 2019-12-24 10:48:09

问题


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"></script>
        <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.

回答1:


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.




回答2:


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">



回答3:


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




回答4:


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




回答5:


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



来源:https://stackoverflow.com/questions/2952795/facebook-connect-graph-problems-in-internet-explorer-with-fblogin-dialog-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!