Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook API Publishing action with JS SDK
    primarykey
    data
    text
    <p>I am really struggling with the facebook api. A have created a app, an object an action, and I want to test to publish in my stream, (I know the public publishing has to be authorised by facebook but as an adminsitrator of my app, I am allowed to test it). But it doesn't wor. Here's the script :</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xmlns:fb="https://www.facebook.com/2008/fbml"&gt; &lt;head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# mehdientest:http://ogp.me/ns/fb/mehdientest#"&gt; &lt;title&gt;OG Tutorial App&lt;/title&gt; &lt;meta property="fb:app_id" content="312683425452812" /&gt; &lt;meta property="og:type" content="mehdientest:Campain" /&gt; &lt;meta property="og:url" content="http://www.example.com/pumpkinpie.html" /&gt; &lt;meta property="og:title" content="Sample Campain" /&gt; &lt;meta property="og:description" content="Some Arbitrary String" /&gt; &lt;meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="fb-root"&gt;&lt;/div&gt; &lt;script&gt; window.fbAsyncInit = function() { FB.init({ appId : '312683425452812', // App ID status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); }; (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)); FB.Event.subscribe('auth.login', function(response) { // do something with response login(); }); FB.Event.subscribe('auth.logout', function(response) { // do something with response logout(); }); FB.getLoginStatus(function(response) { if (response.session) { // logged in and connected user, someone you know login(); } }); function login() { FB.login(function(response) { if (response.authResponse) { FB.api('/me', function(response) { alert('Good to see you, ' + response.name + '.'); }); } else { console.log('User cancelled login or did not fully authorize.'); } }); } function publish() { FB.api('/me/mehdientest:Create?Campain=http://www.example.com/pumpkinpie.html', 'post', function(response) { if (!response || response.error) { alert('msg'); } }); } function logout(){ FB.logout(function(response){}); } &lt;/script&gt; &lt;h3&gt;Example&lt;/h3&gt; &lt;p&gt; &lt;img title="Example" src="" width="550"/&gt; &lt;input type="button" value="Logout" onclick="logout();"&gt;&lt;/input&gt; &lt;input type="button" value="Login" onclick="login();"&gt;&lt;/input&gt; &lt;input type="button" value="Publish" onclick="publish();"&gt;&lt;/input&gt; &lt;div class="fb-login-button" data-show-faces="true" data-width="200" data-max-rows="1"&gt;&lt;/div&gt; &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I have even tried to call the publish() function in the head area, but this doesn't work also.</p> <p>Does anybody has an idea ?</p> <p>Best, Newben</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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