Created
March 5, 2012 17:45
-
-
Save julianshen/1979764 to your computer and use it in GitHub Desktop.
login.html
This file contains hidden or 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
| <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> | |
| <head> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| </head> | |
| <body> | |
| <div id="fb-root"></div> | |
| <fb:login-button width="200" max-rows="1" | |
| scope="user_likes, friends_likes, user_groups, friends_groups, read_stream, read_friendlists, user_activities, offline_access, publish_stream"> | |
| </fb:login-button> | |
| <script type="text/javascript" > | |
| function doLogin(resp) { | |
| if(resp.authResponse) { | |
| console.log('logged in'); | |
| //window.location.href='index.html'; | |
| } | |
| } | |
| window.fbAsyncInit = function() { | |
| FB.init({ | |
| appId : 'YOUR_API_KEY', // App ID | |
| status : false, // check login status | |
| cookie : true, // enable cookies to allow the server to access the session | |
| xfbml : true, // parse XFBML | |
| channelUrl : '//host/channel.html', | |
| oauth : true | |
| }); | |
| FB.getLoginStatus(doLogin); | |
| FB.Event.subscribe('auth.login', doLogin); | |
| // Additional initialization code here | |
| }; | |
| // 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)); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment