Auto-resize canvas after FB init. #14

Closed
wants to merge 1 commit into
from
@@ -393,7 +393,7 @@ function like($options = array()){
* @example $this->Facebook->init();
* @return string of scriptBlock for FB.init() or error
*/
- function init($options = null, $reload = true) {
+ function init($options = null, $reload = true, $FBCanvasSetSize = false) {
if (empty($options)) {
$options = array();
}
@@ -404,6 +404,11 @@ function init($options = null, $reload = true) {
} else {
$callback = "if(typeof(facebookReady)=='function'){facebookReady()}";
}
+
+ if ($FBCanvasSetSize) {
+ $callback = "FB.Canvas.setSize();";
+ }
+
$init = '<div id="fb-root"></div>';
$init .= $this->Html->scriptBlock(
<<<JS
@@ -449,4 +454,4 @@ private function __fbTag($tag, $label, $options){
return $retval;
}
-}
+}