about 4 years ago
For creating logout from facebook we need the facebook javascript SDK.
Code snippets to logout from Facebook is given below :
<script>window.fbAsyncInit = function() { FB.init({ appId : "FACEBOOK_APPLICATION_ID", status : true, cookie : true, xfbml : true, oauth : true }); FB.getLoginStatus(function(response) { if (response && response.status === 'connected') { FB.logout(function(response) { /** Afer logout, Refresh the Page **/ console.log('Logout Successfully.'); document.getElementById('currentStatus').innerHTML='Logout from facebook Successfully.'; //document.location.href='/'; /** Afer logout, Refresh the Page **/ }); }else{ //document.location.href='/'; document.getElementById('currentStatus').innerHTML='You are NOT LOGIN in Facebook.'; console.log('You are not login in Facebook.') } }); }; (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); </script> <h2 id="currentStatus"> Please wait...</h2>
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)