glasspill
glasspill

Reputation: 1300

share button without app id

Can i have a facebook share button without an app id? I have a facebook page, not an app and no associated app.

i have a div

<div class="fb"></div>

and the js file

$('.op-blackfb').click(postToFeed);

var postToFeed = function() {
    var share = {
      method: 'feed',
      u: 'http://mylink.goes/here'
    };
    FB.ui(share, function callback(response) {

        document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
    });

  }

This used to work, but now it fails with an error in the popup dialog, i'm guessing after facebook changed the API. Does anyone know a workaround for this? I want to have a custom share button? I have the normal fb share button, but i want to have an image that doesn't break the design.

This works without an app id but has the standard fb button

 <script>(function(d, s, id) {
                    var js, fjs = d.getElementsByTagName(s)[0];
                    if (d.getElementById(id)) return;
                    js = d.createElement(s); js.id = id;
                    js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1";
                    fjs.parentNode.insertBefore(js, fjs);
                }(document, 'script', 'facebook-jssdk'));

 <div id="fb-root"></div>
 <p id='msg'></p>
 <fb:share-button type="button" style="display:inline-block;" share_url="http://my.link/here"></fb:share-button>

Thank you,

Upvotes: 3

Views: 9137

Answers (1)

JSantos
JSantos

Reputation: 1708

How about a modal iframe? You can use facebooks sharer. You can use any button you want to open up the dialog. The problem is that this uses a facebook page, so you have to merge it into you design with some iframe or you must use a popup

https://www.facebook.com/sharer/sharer.php?u=[the-link-you-want-to-share]

Also facebooks documentation is also very well done

https://developers.facebook.com/docs/reference/dialogs/feed/

Upvotes: 3

Related Questions