diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2011-03-20 00:15:42 +0200 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2011-03-20 00:15:42 +0200 |
| commit | 4bbba8b57f84fd06386f7c4b8e39acc31974091d (patch) | |
| tree | 98b8201ea4b2134381ba75e579dd1a06f3ae20e3 /fb/templates/fb_js.html | |
| parent | 59dae434a4f511bc6f320fa9519dabc176a211b2 (diff) | |
Diffstat (limited to 'fb/templates/fb_js.html')
| -rw-r--r-- | fb/templates/fb_js.html | 30 |
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> |
