Resetting the size of iframe

Facebook allows us to set the size of your application's iframe inside which our content appears. This is useful whenever our content changes, that is, we can change the width and height of our iframe accordingly. Facebook Javascript SDK comes equipped with this functionality and we will show you here how to implement it.

Getting ready

You should have set up index.php as explained in the beginning of the chapter.

How to do it...

The following will help reset the size of iframe:

  1. Open index.php and add the following highlighted code to the div fb-root:
    <div id="fb-root">
      <!-- Your application content here -->
      Width(in pixels): <input type="text" id="width" value="640" />
     Height(in pixels): <input type="text" id="height" ...

Get Facebook Application Development with Graph API Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.