O'Reilly logo

Programming Social Applications by Jonathan LeBlanc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Real-World Example: The Facebook Open Graph

The Facebook implementation of the Open Graph protocol (http://developers.facebook.com/docs/opengraph) allows a site owner to represent his site, business, or product page as if it were a Facebook page, without it actually residing in the social network.

The Facebook Open Graph consists of a few pieces, implemented by a site owner:

  • The Open Graph protocol <meta> tags to define the site object

  • A few Facebook administration tags

  • The Facebook Like button

It currently only supports web pages that represent real-world things such as sports teams, movies, actors, restaurants, etc.

The Facebook Like button is a simple page implementation that displays a button with the word Like on it. When a user likes a page, his name and profile—as well as those of any of his friends who have liked the same page—is displayed, as shown in Figure 10-2.

The Facebook Like button on a website

Figure 10-2. The Facebook Like button on a website

Once the user clicks Like, he is connected to the page containing the Like button, and the like instance is subsequently published on his profile. The Like button is included on a page via either an iframe or the Facebook JavaScript API and the <fb:like> XFBML tag.

Under the likes and interests sections of the user’s profile, the new like instance will be displayed, and under his news feed’s recent activity, a like notice will be posted (Figure 10-3).

Figure 10-3. How a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required