Saturday, August 3, 2013

Embedding Facebook Public posts into your blog

Recently Facebook showed a new feature that allow users in general to insert any public post into their website. The bad news is that this is not available to all users yet and is not available to all public posts either. You have to wait until they decide to release it.


The good news is that the guys from Digital Inspiration posted the code that allows you to embed a post with or without this feature enabled.

It’s quite simple. Copy the following code

<div id="fb-root"></div>
<script> (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id))
    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="PLUBLIC_POST_LINK"></fb:post>

Now go into your post and check it out. Easy as hell.

No comments:

Post a Comment