Thursday, March 31, 2011

How to use XFBML.ProfilePic

I am trying to display a Facebook user's profile picture using XFBML. I am using the following code:

var container = document.getElementById("profilePicture");
var profilePic = new FB.XFBML.ProfilePic(container);
//profilePic.setAttribute("uid", userId);
FB.XFBML.Host.addElement(profilePic);

How do I set the uid attribute of the element? (the commented line does not work)

From stackoverflow
  • Set the attribute before sending it to ProfilePic for processing:

    var container = document.getElementById("profilePicture");
    container.setAttribute("uid", userId);
    var profilePic = new FB.XFBML.ProfilePic(container);
    FB.XFBML.Host.addElement(profilePic);
    

0 comments:

Post a Comment