02 August, 2013

How to Embed Any Facebook Post

Facebook has added a new “embedded posts” feature to help you embed any Facebook content – you can embed photographs, videos or even regular status updates – on another website or blog. For instance, if a celebrity has shared a photograph on his or her Facebook Page, you can easily embed that image on your website by adding a single line of code.


You may embed any content that’s shared on Facebook Pages and personal profiles as long as the content owner has set the visibility of that post to Public.
There’s a small catch though. Facebook has enabled the Embedded Posts functionality for a handful of big web publishers including CNN, Mashable and The Huffington Post. Everyone else will have to wait to see that Embed link alongside their Facebook content.
Here’s the trick. Open any Facebook Post and copy the permalink (permanent URL) of that post. You can right-click the date of the post to determine its permalink. Next replace YOUR_URL_HERE in the snippet below with the permalink that you just copied and paste the modified snippet anywhere in your website. Done!

<div id="fb-root"></div><script>(function(d, s, id) {    var js, fjs = d.getElementsByTagName(s)[0];    if (d.getElementById(id))        return;    js = d.createElement(s);    js.id = id;    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";    fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><fb:post href="YOUR_URL_HERE"></fb:post>


If you wish to embed another Facebook post on the same web page, you don't have to copy-paste the entire snippet. Just add a new <fb:post> element and set the value of href as the permalink of your Facebook Post.

No comments:

Post a Comment