Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE7 - setAutoGrow doesn't work

I have created a facebook application that I am using inside a tab's iFrame.

I am using the setAutoGrow function of the Javascript SDK to make the iFrame expand until the end of the content.

From my observations, the setAutoGrow function does not work in IE7, and I can't figure out why. All other browsers (including IE8 and 9) are working correctly.

For testing purposes, I have created a gradient that is 1500px high.

Example gradient for testing purposed of 1500px height

As an example, I will post what it looks like in Chrome. As you can see, the gradient can be scrolled until the end (red color):

Gradient inside iFrame tab works as expected in normal browsers

And now comes what happens in IE7. The iFrame has a default height of 800px (as defined in the app settings). You can see that it stops at "turquoise", and the setAutoGrow function does not extend it to the desired height (1500px).

Gradient inside iFrame tab doesnt expand in IE7

The important part of my CSS looks as follows:

body, html { 
    overflow: hidden;        
    margin: 0; padding: 0;
}

    #wrapper {
        margin: 0 auto;
        width: 810px;    
    }

        #content {
          background: url(../img/bg.jpg) top left no-repeat;
          height: 1500px;
        }

And this is the javascript snippet I've placed just before the closing body-tag and after the fb-root tag:

window.fbAsyncInit = function() {

    FB.init({

        appId      : '...',
        channelUrl : '...',
        status     : true,
        cookie     : true,
        xfbml      : true

    });

    FB.Canvas.setAutoGrow();

};

I have found a bug report that dates back to the 1st of August, which has been closed by FB: https://developers.facebook.com/bugs/209607222498543?browse=search_5009002cb69058a73627413

I have read and applied the hints from the following topic: Facebook iframe FB.Canvas.setAutoGrow does not auto grow after initial load?

... but nothing seems to solve the problem.

Does anyone have an obvious hint, something I have overseen, or an easy solution/workaround for this problem?

While I was using IE7 DebugBar I noticed that it was having a problem loading a URL called "dimension_context.php". I will attach the screenshot.

IE7 DebugBar loading problem

like image 979
Marcel Kalveram Avatar asked Aug 14 '12 23:08

Marcel Kalveram


2 Answers

I am using this may be it helps you

<html>
<body>
    <div id="fb-root">
    </div>
    <script type="text/javascript" language="javascript" src="http://connect.facebook.net/en_US/all.js"></script>
    <script type="text/javascript" language="javascript">
        FB.init({
            appId: 'APPID',
            status: true, // check login status
            cookie: true, // enable cookies to allow the server to access the session
            xfbml: true// parse XFBML
        });
        window.fbAsyncInit = function () {
            FB.Canvas.setSize();
        }
        //  FB.Canvas.setAutoResize();
        FB.Canvas.setAutoGrow(7);
    </script>
<form></form>

</body>
</html>
like image 92
Anant Dabhi Avatar answered Sep 21 '22 15:09

Anant Dabhi


Have you tried busting the all.js's cache by adding a random GET parameter to it? Also, I'd rewrite the http:// part to // so the javascript file would load properly in case facebook is in https mode.

<script type="text/javascript" language="javascript" src="//connect.facebook.net/en_US/all.js?v1"></script>
like image 42
Attila Szeremi Avatar answered Sep 18 '22 15:09

Attila Szeremi