Testing the Facebook Share dialog box with localhost - "Unable to resolve object at http: // localhost"

I am trying to use the current (currently ask this question) Facebook use dialog using only the URL (not the SDK).

My JS looks like this:

openFacebookPopup : function (url) {
        this.openSharerWindow('https://www.facebook.com/dialog/share' + '?app_id=145634995501895' + '&display=popup' + '&href=http%3A%2F%2Flocalhost' + '&redirect_uri=http%3A%2F%2Flocalhost');
        return false;
}

The error I am getting is:

Failed to resolve the object by URL http://localhost/.

What does this mean and how can I try to solve it? I should note that this JS works without problems using the old sharer.php url for facebook.

I have http://localhostadded to my application.

+7
source share
3 answers

FB , .

SDK Javascript , :

  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'your-app-id',
      xfbml      : true,
      version    : 'v2.3'
    });
  };

  (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/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));

, , , :

$('#fb-share-button').click(function() {
    FB.ui({
          method: 'feed',
          link: "The link you want to share", 
          picture: 'The picture url',
          name: "The name who will be displayed on the post",
          description: "The description who will be displayed"
        }, function(response){
            console.log(response);
        }
    );
});

console.log , , . , , .

+7

@WizKid , Facebook (, <meta property="og:title" content="My awesome site" />, ... . share , localhost. , facebook url: https://developers.facebook.com/tools/debug/

URL- localhost ( URL- ), , facebook, .

+5

facebook localhost .

follow the steps source: facebook localhost

0
source

All Articles