Reputation: 3
This is a new thing. At least up to IE 8 getting a doesn't support method in all.js and seems to be breaking on the FB.Canvas.setAutoResize();
This is stopping our auto resize from working in IE and I can't seem to get a workaround that works without throwing some kind of exception.
window.fbAsyncInit = function() {
FB.init({
appId : js_fb_app_id,
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true
});
FB.Canvas.setAutoResize();
};
Upvotes: 0
Views: 1219
Reputation: 373
Remember to load your javascript file as asynchronous this means that it will execute only after finishing loading the whole file, this might be your case the import statement should look like next:
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'your app id', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
Hope this helps you! :)
Upvotes: 0
Reputation: 3425
You use window.fbAsyncInit hook to execute FB.Canvas.setAutoResize();
window.fbAsyncInit function will be executed when the Facebook library is loaded, but not when the whole page is loaded.
When the page in not fully loaded the FB.Canvas.setAutoResize(); will not work correctly because will not know the correct height of your content. You can use window.onload to execute FB.Canvas.setAutoResize(); when the page if fully loaded.
Try this:
window.fbAsyncInit = function() {
FB.init({
appId : js_fb_app_id,
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true
});
};
window.onload=function(){
FB.Canvas.setAutoResize();
}
Upvotes: 1