0

I am searching for some days a possibility to reveal a hidden div after a visitor shares a link but i couldn't find anything. I've tried here something http://jsfiddle.net/trefu/qNDJB/9/ but is not working. Can someone give me a little help please.

Download Box (whatever that means) goes here
window.fbAsyncInit = function() {
    FB.init({
      appId      : '437410746335629', // App ID
      channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here
  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));




FB.init({appId: "437410746335629", status: true, cookie: true});

  function postToFeed() {

    // calling the API ...
    var obj = {
      method: 'feed',
      link: 'https://developers.facebook.com/docs/reference/dialogs/',
      picture: 'http://fbrell.com/f8.jpg',
      name: 'Facebook Dialogs',
      caption: 'Reference Documentation',
      description: 'Using Dialogs to interact with users.'
    };

  function callback(response) {
    if (response && response.post_id) {
        document.getElementById('download_box').style.display = 'block';
    } else {
        alert('You must share your post before you can download.');
    }
}

    FB.ui(obj, callback);
  }
Matt Burland
  • 44,552
  • 18
  • 99
  • 171
  • Does the callback actually get called? Can you set a breakpoint in there? – Matt Burland Mar 22 '13 at 17:00
  • I've tested here : http://wowvi.blogspot.ro/ but when i click Post To Feed i get some errors: API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: redirect_uri is not owned by the application. – Inna Marina Mar 22 '13 at 17:05
  • Ok, so it looks like your problem is actually with the Facebook API rather than javascript of jquery. I've added the Facebook tag to your question. – Matt Burland Mar 22 '13 at 17:20
  • This question might help you: http://stackoverflow.com/questions/4691782/facebook-api-error-191 – Matt Burland Mar 22 '13 at 17:21
  • thank you Matt, i will try to make it work after i read that question :) – Inna Marina Mar 22 '13 at 17:42

1 Answers1

0

The code you have specified should work in what you are trying to achieve. The problem is with your application settings. Make sure your domain is set in the Facebook App Settings page, specifically update the 'App Domains' and 'Site URL' fields. You will find that the feed dialog error you're getting will then be resolved.

Niraj Shah
  • 15,087
  • 3
  • 41
  • 60