Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook send dialogue authentication
    text
    copied!<p>I’m creating a custom share to facebook functionality, which has been more complicated than I originally thought.</p> <p>I’ve had to create a facebook app and then use It’s ID to get it going.</p> <p>If you try to share the page on facebook, it gets you login to facebook(if not logged in), then it requests access to your profile(only on your first share), and then proceeds to share dialogue to let you share it.</p> <p>However I’ve noticed that other sites including youtube and BBC, that they don’t request access to share on facebook, It will take you straight to the share dialogue instead.</p> <p>Is there a way to achieve this?</p> <p>Code using is below:</p> <pre><code>&lt;script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt; &lt;script&gt; FB.init({ appId : '*APP_ID*', // App ID status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true, // parse XFBML link : '*LINK*' }); $('.share-print .facebook &gt; a').click(function(e){ e.preventDefault(); FB.getLoginStatus(function(response) { if (response.status === 'connected') { facebookSend(); var uid = response.authResponse.userID; var accessToken = response.authResponse.accessToken; } else if (response.status === 'not_authorized') { // the user is logged in to Facebook, // but has not authenticated your app FB.login(function(response) { if (response.authResponse) { console.log('Logged in'); facebookSend(); } else { console.log('Not logged in'); } }); } else { // the user isn't logged in to Facebook. FB.login(function(response) { if (response.authResponse) { console.log('Logged in'); facebookSend(); } else { console.log('Not logged in'); } }); } }); }); var facebookSend = function() { console.log('facebookSend started'); FB.ui({ method: 'feed', display: 'iframe', link: '*PAGE_LINK*' }); } &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload