How to embed Facebook videos in web pages / wordpress posts?

Ankita Katdare

Ankita Katdare

@abrakadabra Oct 26, 2024
So, you might have heard that Facebook recently introduced the facility of embedding Facebook videos in your web pages. This essentially means that Facebook content can now be shared outside of their platform much like how we share YouTube or Vimeo videos.
I however tried to use this functionality but am not getting the expected results.

I have a wordpress blog and I tried embedding the Facebook video by using the code provided by Facebook.

Here's what I did.

1. Go to Facebook video page. Below the video on the right hand side there's a link called 'Embed Video'. Click on it.

Screen Shot 2015-04-27 at 8.55.59 am

2. On clicking the link, an overlay appears where you can copy the embed code. Here's what it looks like:

Screen Shot 2015-04-27 at 8.57.37 am

3. I copied the code and pasted it in my WordPress post.

But it just doesn't work! 👎😔

Then I tried a different method -

Every video on Facebook has a unique ID string that can be seen in the URL.
The ID lies next to the parameter v.
Example: (?v=XXXXXXXXXXXX).
So, I used the iframe tag:

<iframe src=”https://www.facebook.com/video/embed?video_id=XXXXXX”
width=”540″ height=”420″ frameborder=”0″></iframe>
Just replaced the XXXX with the facebook video ID.
However, still no results.

Is this facility still not working properly from Facebook's side? Has anyone tried it?
Please help.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Apr 26, 2015

    Can you paste post url here?
  • Ankita Katdare

    Ankita Katdare

    @abrakadabra Apr 26, 2015

    Manish Goyal
    Can you paste post url here?
    Of the facebook video OR wordpress post?
    I didn't publish the post.
  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Apr 26, 2015

    Wordpress post url, there might be some script conflicts or something,
  • Ankita Katdare

    Ankita Katdare

    @abrakadabra Apr 26, 2015

    Manish Goyal
    Wordpress post url, there might be some script conflicts or something,
    Will try to publish a demo post and paste link here. Meanwhile, could you check if any of the above methods are working on any of your wordpress domains?
  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Apr 26, 2015

    Just debug the problem, from facebook, the code is something like this

    replace sdk.js with all.js inside your code

    means

    //connect.facebook.net/en_US/sdk.js will be //connect.facebook.net/en_US/all.js

    Demo: #-Link-Snipped-#
  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Apr 26, 2015

    Wordpress won't allow you to embed scripts inside your post content, mine is on my own hosting i.e why it is working
  • Ankita Katdare

    Ankita Katdare

    @abrakadabra Apr 26, 2015

    Manish Goyal
    Wordpress won't allow you to embed scripts inside your post content, mine is on my own hosting i.e why it is working
    Right! That was the problem! I will check with another domain and update here.
    Meanwhile, could you tell us what difference did replacing sdk.js with all.js make for it to work?
  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Apr 26, 2015

    I am not sure, all I know is sdk is part of recent version (2.3) of facebook sdk, according to their recent documentation in old code where ever developers are using all.js they should use sdk.js to support latest features.
    since sdk.js was not working, I tried replacing it with all.js and it worked