Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Load jQuery & Facebook asynchronously with LAB.js
<html lang="en" prefix="og:" xmlns:fb="">
<head><title>Hello Facebook</title></head>
<div id="content"></div>
<div id="fb-root"></div>
<script src="/path/to/js/LAB.min.js"></script>
window.fbAsyncInit = function() {
// jQuery will be loaded due to the LAB.js "wait"
channelURL: '//', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
oauth: true // enables OAuth 2.0
// Additional initialization code here
FB.getLoginStatus(function(response) {
if (response.authResponse) {
// logged in and connected user, someone you know
console.log('you know this user!!');
} else {
// no user session available, someone you don't know
console.log('Howdy Stranger!');
// END additional initialization
// Load the SDK Asynchronously, neither jqueryui NOR facebook will execute until jquery loaded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.