summaryrefslogtreecommitdiff
path: root/fb/templates/fb_js.html
diff options
context:
space:
mode:
Diffstat (limited to 'fb/templates/fb_js.html')
-rw-r--r--fb/templates/fb_js.html30
1 files changed, 21 insertions, 9 deletions
diff --git a/fb/templates/fb_js.html b/fb/templates/fb_js.html
index 199281c..da728ac 100644
--- a/fb/templates/fb_js.html
+++ b/fb/templates/fb_js.html
@@ -1,11 +1,23 @@
<div id="fb-root"></div>
-
-<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
- FB.init({
- appId : '{{ FACEBOOK_APP_ID }}',
- status : true, // check login status
- cookie : true, // enable cookies to allow the server to access the session
- xfbml : true // parse XFBML
- });
-</script> \ No newline at end of file
+ window.fbAsyncInit = function() {
+ FB.init({
+ appId: '{{ FACEBOOK_APP_ID }}',
+ status: true,
+ cookie: true,
+ xfbml: true
+ });
+
+ FB.Event.subscribe('auth.sessionChange', function(res) {
+ if (res.session) {
+ alert('authenticated!');
+ }
+ });
+ };
+ (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>