How to Embed Facebook Videos in your Web Pages

H
Published in: Embed - Facebook

Facebook, like YouTube, now allows to you easily embed videos on web pages outside Facebook. That means if you come across an interesting video on Facebook, you can easily put it on your blog without having to direct your audience to the Facebook website.

There are two important points to consider though. One, you should only embed videos that are public. Facebook does provide the embed code for private videos that are shared with you or your network but your audience won’t be able to play these videos on your website.

The other issue is that Facebook still uses the Adobe Flash player to embed videos when your website is viewed on a desktop. It automatically switches to the HTML5 format on mobile devices but if someone is viewing your website from a desktop or laptop, they would need the Shockwave Flash plugin enabled to view your embedded videos.

Add Facebook Videos to your Website

First, let’s find a video on Facebook using Graph Search. Go to the search box and type a search query like videos of cats liked by my friends or videos uploaded by me or videos uploaded by my friends of friends.

Embed Facebook Video

Next click the video thumbnail to open the video play in a lightbox window. Hover your mouse over Options and choose Embed Video from the drop-down. Facebook will provide a snippet of code that you can directly copy and paste in your website template or your blog post.

Please note that you need to be logged in to your Facebook account for generating the embed code.

Here’s a sample video embedded from Facebook.

<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/sdk.js#xfbml=1&version=v2.3";  fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><div class="fb-video" data-allowfullscreen="true" data-href="https://www.facebook.com/video.php?v=10152463995718183&amp;set=vb.500808182&amp;type=1"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/video.php?v=10152463995718183&amp;set=vb.500808182&amp;type=1"><a href="https://www.facebook.com/video.php?v=10152463995718183">Indian Head Massage</a>Uploaded by <a href="https://www.facebook.com/agarwal.amit">Amit Agarwal</a></blockquote></div></div>

Related: How to Embed Facebook Photos

The embedded videos are responsive and occupy the full width of the parent div. If you would like to constraint the video width or need to wrap text around the video, you’ll need to modify the .fb-video class as show in the snippet below:

<style>
  .fb-video {

    /* Do not occupy the full width*/
    max-width: 300px !important;

    /* Align the video to the right of a page and wrap the text */
    float: right;

    /* Add a Grey border to the video */
    border: 2px solid grey;

  }
</style>

Also see: How to Embed Almost Anything in your Website

📮  Subscribe to our Email Newsletter for Google tips and tutorials!
Published in: Embed - Facebook

Looking for something? Find here!

Meet the Author

Web Geek, Google Developer Expert
A
Amit Agarwal

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India. He is the developer of Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Get in touch

Google Add-ons

Do more with your Gmail and GSuite account
G

We build bespoke solutions that use the capabilities and the features of Google Workspace for automating business processes and driving work productivity.

  1. Mail Merge with Attachments
    Send personalized email to your Google Contact with a Google Sheet and Gmail
  2. Save Emails and Attachments
    Download email messages and file attachments from Gmail to your Google Drive
  3. Google Forms Email Notifications
    Send email notifications to multiple people when a new Google Form is submitted
  4. Document Studio
    Create beautiful pixel perfect documents merging data from Google Sheets and Google Forms
  5. Creator Studio for Google Slides
    Turn your Google Slides presentations into animated GIFs and videos for uploading to YouTube