Skip to content Skip to sidebar Skip to footer

Resizing Canvas For The App

we have been trying to setup the height for a canvas app without luck. this is the code we are using window.fbAsyncInit = function() { // assume we are already logged in FB.init({a

Solution 1:

After you setup the fixed height parameter in your application settings,
you can call FB.Canvas.setSize to change the page height.

If your page height changes dynamically, you can run FB.Canvas.setDoneLoading
to check if Canvas is loaded and run FB.Canvas.setAutoGrow.

window.fbAsyncInit = function() {
    // assume we are already logged in
    FB.init({ appId: '<?=$fb_app_id ?>', xfbml: true, oauth: true, cookie: true });

    FB.Canvas.setSize({ width: 810, height: 950 });

    FB.Canvas.setDoneLoading( function(response) {
        console.log(response.time_delta_ms);
        FB.Canvas.setAutoGrow();
    });
}

FB Documentation: https://developers.facebook.com/docs/reference/javascript/FB.Canvas.setDoneLoading/


Post a Comment for "Resizing Canvas For The App"