Facebook Connect / Graph - problems in Internet Ex

2019-08-10 09:22发布

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

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.

5条回答
叛逆
2楼-- · 2019-08-10 09:41

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.

查看更多
再贱就再见
3楼-- · 2019-08-10 09:41

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楼-- · 2019-08-10 09:42

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">
查看更多
Rolldiameter
5楼-- · 2019-08-10 09:58

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

查看更多
小情绪 Triste *
6楼-- · 2019-08-10 10:03

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

查看更多
登录 后发表回答