Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Facebook Widget Demo</title>
- <!-- Dependencies -->
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
- <!-- Application -->
- <link rel="stylesheet" type="text/css" href="app.css" />
- <script type="text/javascript">
- var FB_APP_ID = 'INSERT_APP_ID';
- window.fbAsyncInit = function() {
- FB.init({
- appId: FB_APP_ID,
- status: true, // check login status
- cookie: true, // enable cookies to allow the server to access the session
- xfbml: true // parse XFBML
- });
- $('#login').click(function(){
- FB.login(function(response) {
- if (response.authResponse) {
- console.log('Success.');
- } else {
- console.log('User cancelled login.');
- }
- });
- });
- $('#check-login-status').click(function(){
- var force = false;
- FB.getLoginStatus(function(response) {
- console.log('Login status (force='+force+'):');
- console.log(response);
- }, force);
- });
- };
- // Load Facebook SDK asynchronously
- (function(d){
- var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
- js = d.createElement('script'); js.id = id; js.async = true;
- js.src = "http://connect.facebook.net/en_US/all.js";
- d.getElementsByTagName('head')[0].appendChild(js);
- })(document);
- </script>
- </head>
- <body>
- <div id="fb-root"></div>
- <a id="login" href="#">Login</a><br />
- <a id="check-login-status" href="#">Check Login Status</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement