Skip navigation

Tag Archives: javascript

I wanted to post custom comments to my Facebook page using Facebook’s dialog. You need the Page’s UID to be able to post to it, and there’s no way in the Open Graph protocol to get the ID of a given URL. Here’s how you do it using the Javascript SDK and FQL:

function facebookGetIdForUrl(url, callback) {
    //see http://developers.facebook.com/docs/reference/fql/object_url/
    FB.api(
          {
            method: 'fql.query',
            query: "SELECT id FROM object_url WHERE url = '" + url + "'"
          },
          function(response) {
            callback(response[0].id);
          }
        );
}

facebookGetIdForUrl("http://facebook.com",
     function (id) {

        alert("Facebook ID = " + id);

    });

 

I just made this rather Carebear-colored painting straight in my browser, no Flash required, with an HTML5 app called Harmony! It was nice and fast too in Firefox. Mr. Doob does it again, with his pure HTML5 + Javascript genius!

Seeing this makes me want to bring back my master’s thesis, Doodler. It was a social network based on drawing games, kind of a mash-up between Harmony and Facebook. I originally programmed it all in Flash, but it never really progressed past the beta (mainly for my pure hatred of Flash, secondly because I graduated and it was TIME FOR SUMMER! WOOO!). An HTML5 implementation though…. hmmmm…