Created
February 19, 2013 01:46
-
-
Save jimmyhillis/4982408 to your computer and use it in GitHub Desktop.
Remove the default height restriction from Facebook iFrame tabs with a simple JavaScript callback run as soon as the Facebook SDK is initialized.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.fbAsyncInit = function() { | |
FB.init({ | |
appId: '415273505232476', | |
status: true, | |
cookie: true, | |
xfbml: true | |
}); | |
FB.Canvas.setAutoGrow(); | |
}; | |
// Load the SDK Asynchronously | |
(function(d){ | |
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; | |
if (d.getElementById(id)) {return;} | |
js = d.createElement('script'); js.id = id; js.async = true; | |
js.src = "//connect.facebook.net/en_US/all.js"; | |
ref.parentNode.insertBefore(js, ref); | |
}(document)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This can be placed in an included JS file within your app code or "inline" within the
<head>
tags if you aren't using any other code and want to keep requests down. Don't wrap any of this code within a$(document).ready()
callback if you are using jQuery; it should be global.