# Facebook embedded pages

Questions or comments?

## Purpose

Helps with implementing Facebook embedded pages.

## Working example

- English example
- French example

## How to implement

1. Create an embedded page on the Facebook Page Plugin documentation.
2. Press the "Get Code" button and copy only the HTML portion in the second section of the popup
3. For each area that will display a Facebook embedded page, create a `div` element with `class="wb-facebook"`.

       <div class="wb-facebook"></div>

4. Inside the div paste the HTML code from the "Get Code" button in the earlier step

## Events

Event | Trigger | What it does
--- | --- | ---
`wb-init.wb-facebook` | Triggered manually (e.g., `$( ".wb-facebook" ).trigger( "wb-init.wb-facebook" );`). | Used to manually initialize the Facebook embedded pages. Note: The Facebook embedded page will be initialized automatically unless the required markup is added after the page has already loaded.
`wb-ready.wb-facebook` (v4.0.5+) | Triggered automatically after the Facebook embedded page initializes. | Used to identify where the Facebook embedded page was initialized (target of the event).
    $( document ).on( "wb-ready.wb-facebook", ".wb-facebook", function( event ) {
    });
    $( ".wb-facebook" ).on( "wb-ready.wb-facebook", function( event ) {
    });
`wb-ready.wb` (v4.0.5+) | Triggered automatically when WET has finished loading and executing. | Used to identify when all WET plugins and polyfills have finished loading and executing.
    $( document ).on( "wb-ready.wb", function( event ) {
    });

## Source code

Facebook embedded pages plugin source code on GitHub

Date modified:
  2015-08-03