收录日期:2019/10/22 14:28:08 时间:2009-11-11 00:17:03 标签:facebook,connect

As I understand it, Facebook's FBML should render html. But mine isn't. Here is my source code after viewing the page in the browser:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">  
<head id="Head1" runat="server"> <title>test</title> 
</head>  
<body onload="initFB();">
    <script src="http://static.new.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
        type="text/javascript"></script>       


        <fb:login-button v="2" size="medium" onlogin="window.location='test.aspx'">Login with your Facebook account</fb:login-button>


    <script type="text/javascript" language="text/javascript">
        function initFB() {
            FB_RequireFeatures(["XFBML"], function(){
                FB.init("464 ... my api key here ... b62", "xd_receiver.htm");
            });}
    </script>
</body>  
</html>

Here's the page: http://www.rebelstudent.com/test.aspx

Could it be the server? Is there any change that my host is blocking communication with Facebook somehow? Doesn't make sense because the facebook connect kinda works...the popup windows just doesn't go away. I'm pretty sure it's because these FBML tags aren't being rendered properly and so the "onlogin" function isn't getting called...

Anway, I'm new at this. Any help is appreciated because the facebook developer forums seem kind of dead.

I haven't done any work on Facebook so I don't have a direct answer for you, sorry. However, have you tried starting with a "Hello World" app? Basically remove everything that is not absolutely necessary for Facebook and try to display the text "Hello World" to the screen. Remove the script, the header, fb button, etc.

If you are able to get "Hello World" working, then just add small pieces of the application back in until it breaks. Then you will know exactly what it is that is breaking the output.

If you are not able to get "Hello World" to work, then you are missing a basic requirement. Perhaps somebody else will know what that is.

Well it looks like I need to always use "www" in front of my domain. That was my issue. rebelstudent.com/test.aspx doesn't work but www.rebelstudent.com/test.aspx does. Thanks for everyone's help!

More than likely the problem is your render method for your canvas is set to an IFrame (instead of FBML).

FB_RequireFeatures(["XFBML"], function() { FB.Facebook.init("key", "/xd_receiver.htm"); FB.Connect.requireSession(); FB.ensureInit(function() { FB.Connect.showPermissionDialog("offline_access,read_stream", function(x) { alert(x); window.location = "/myAuthorizeApp"; }); }); });

It doesn't do quite the same thing as you're trying to achieve, but I found I needed to require XFBML to get the the other JS functions to work properly, strange enough.. Also, look into rendering XFBML server side.