Skip navigation

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) {
            method: 'fql.query',
            query: "SELECT id FROM object_url WHERE url = '" + url + "'"
          function(response) {

     function (id) {

        alert("Facebook ID = " + id);



Leave a Reply