• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Perishing Facebook app - Help!"

Collapse

  • NickFitz
    replied
    I haven't done much with FB Connect yet, but as a general rule one should always keep an eye on the HTTP traffic for Ajaxy stuff. Use something like Fiddler (free, Windows only) or Charles (Windows/Mac/Linux, payware, but will run for 30 minutes at a time without payment, which is often enough). At least you can then see what's going out over the wire, and what FB is sending back, which usually helps.

    Alternatively you can use the Net tab in Firebug, but IIRC that won't show any redirects, which is why I prefer using Charles.

    Leave a comment:


  • Zippy
    replied
    Ah well if you've done the alerty thing then it must be FB.
    I have used Firebug but not sure it would help (can't hurt though!) in this instance.
    I'm sure Nick will turn up and tell us all about a (not) well documented bug.

    Have a beer

    Leave a comment:


  • OwlHoot
    replied
    Originally posted by Zippy View Post

    I know less than sod all about FB, so I'm just going to offer moral support (and ask some dumb questions).

    Does the button do anything at all (i.e does jsInviteFriends get called)?
    Assuming it does are there any JS errors at all?
    Hi Zippy. Thanks for your reply. No the invite button does nothing. But I peppered alert calls all over the place, and everything seemed to run right through. So am fairly sure there are no Javascript errors.

    Also nothing appears on the Firefox error log when I click the "Invite" button, which is further evidence that the Javascript is OK and the problem lies with the pesky Facebook API!

    However, since posting I have learned that the Facebook Javascript API has an FB.debug flag or level (notes at clientco, so can't check). So I'll try running it with that on monday.

    As a last resort I may have to download the API "js" file and start plastering *that* with alerts to see what is going on. Or perhaps now might be a good time to start dabbling with Firebug.

    I'm not quite at my wits end yet, but any suggestions would still be welcome.

    Leave a comment:


  • Zippy
    replied
    I know less than sod all about FB, so I'm just going to offer moral support (and ask some dumb questions).

    Does the button do anything at all (i.e does jsInviteFriends get called)?
    Assuming it does are there any JS errors at all?

    Leave a comment:


  • OwlHoot
    started a topic Perishing Facebook app - Help!

    Perishing Facebook app - Help!

    I'm back on the Facebook functionality I asked about earlier this week, something clientco want bolted onto their fantasy games web apps.

    I got the "post comment to user's wall" working fine, but am having problems with the second requirement "invite friends to join game" (sample web page appears below).

    The Facebook documentation is utter tulip, as they're constantly upgrading to new rubriks (if that's the right word) and what documentation exists is either very sketchy or absurdly geeky with nothing in between, and precious few decent examples. I imagine even O'Reilly are holding off for now on publishing a "Facebook Cookbook".

    Anyway, enough whining. Here is the code. I know all the API keys and signatures etc are fine, and the Facebook channel file is being found (because as I said the "Post to Wall" functionality is working fine).

    But if anyone can see any obvious reason why the "invite friends" button does nothing, it'll be a big help and much appreciated.

    This is a third-party app by the way, which connects to Facebook via (at NickF's suggestion) Facebook Connect. So it doesn't run within the Facebook canvas or IFrame (or whatever Facebook are calling their "framework" today!)

    (Please God, let NickF look in sometime this weekend! )

    Code:
    
    <!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">
     <body>
    
    <script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
    
    
      <script type="text/javascript">
    
      // Post comment on user's Facebook wall
      //
      function jsPostWall()
      {
        // Initialize facebook
        //
        FB_RequireFeatures(["Connect"], function()
        {
          // Create an ApiClient object, passing app's API key and a site relative URL to xd_receiver.htm
          //
          FB.Facebook.init('b8ca874634d495f76378c7ee8e1aded2', 'xd_receiver.htm');
    
          FB.ensureInit(function()
          {
    //      FB.Facebook.get_sessionState().waitUntilReady(function()
    //      {
              FB.Connect.showPermissionDialog("publish_stream", function(perms)
              {
                 if (perms == "publish_stream")
                 {
                   var message = 'JR test message text here';  // text user entered themselves
    
                   var attachment =
                   {
                     'name': 'JR test post name',
                     'href': window.location.href,
                     'caption': 'JR test post caption',
                     'description': 'JR test post description'
                   };
    
                   var action_links =  [ { 'text': 'JR action text', 'href': 'http://www.google.com' } ];
    
                   var target_id    = null;   // post on user's wall (as opposed to friend's wall for example)
    
                   var auto_publish = false;  // false => prompt for user approval even if they have previously granted publish_stream
    
                   var actor_id     = null;
    
                   // see  http://developers.facebook.com/docs/?u=facebook.jslib.FB.Connect.streamPublish
                   //
                   FB.Connect.streamPublish(message, attachment, action_links, target_id,
                                           "JR test default text", callback, auto_publish, actor_id);
                }
              });
    //      });
          });
        });
    
        function callback(post_id, exception)
        {
          alert('Wall Post Complete');
        }
      }
    </script>
    
    
    
    
    <fb:login-button></fb:login-button>
    
    <div id="fb_users"></div>
    
    <script type="text/javascript">
    
      function jsInviteFriends()
      {
        // Initialize facebook
        //
        FB_RequireFeatures(["Connect"], function()
        {
          // Create an ApiClient object, passing app's API key and a site relative URL to xd_receiver.htm
          //
          FB.Facebook.init('b8ca874634d495f76378c7ee8e1aded2', 'xd_receiver.htm');
    
          FB.ensureInit(function()
          {
    
            FB.Facebook.get_sessionState().waitUntilReady(function()
            {
    
        document.getElementById("fb_users").innerHTML =
           (<r><![CDATA[
            <fb:request-form action="POST_ACTION_URL"    // URL blanked out [OH]
               method="POST"
               invite="true"
               type="JR test invite title"
               content="&lt;fb:name uid=&quot;&quot; firstnameonly=&quot;true&quot; shownetwork=&quot;false&quot;/&gt; invites you to play a fantasy game
    &lt;fb:req-choice url=&quot;http://www.google.com&quot; label=&quot;Google&quot;/&gt;
    ">
               <fb:multi-friend-selector
                  max="20"
                  actiontext="Invite your friends to start playing this game today!"
                  showborder="true"
                  rows="5">
               </fb:multi-friend-selector>
            </fb:request-form>
               ]]></r>).toString();
    
        FB.XFBML.Host.parseDomTree();
    
            });
    
          });
        });
      }
    
    </script>
    
    
      <br></br>
    
      <a href="#" onclick="jsPostWall(); return false;">Post a story on your Facebook Wall!</a>
    
      <br></br>
    
      <a href="#" onclick="jsInviteFriends(); return false;">Invite your Facebook friends!</a>
    
     </body>
    </html>
    I mean for a start, what the flip's the difference between FB.Facebook.init() and FB.init() ?!

    edit: POST_ACTION_URL is where the Facebook Javascript redirects after completing the action, i.e. back to the client's app. I blanked this out for client confidentiality reasons.
    Last edited by OwlHoot; 9 April 2010, 13:02.
Working...
X