1

I have looked around quite a bit on this and spent significant time trying many different things. These threads are a little dated and in some cases supply many different options.

Facebook App: localhost no longer works as app domain

Facebook like/share current URL

Testing Facebook Share Dialog with localhost - "Unable to resolve object at URL http://localhost"

Everything has pieces, but I an unable to put them together or am missing something. I am hoping someone can help clarify/identify for me. It is greatly appreciated.

  1. Can you "really" and "actually" debug the Facebook jsSDK on "localhost" for development of the different social plugins??? (The ones only included with the SDK) https://developers.facebook.com/docs/plugins I am NOT using, nor want to use OpenGraph.

  2. If YES, to 1. Then do you need to use a Test-App for your FB App?

  3. I have the OWIN/OAuth dialed! and get the externalLogin info and SetAuthCookie just fine. I am also able to initiate the Facebook jsSDK and render the fb-like iFrame just fine. Here is where all my problems are: details and set-up as follows:

    With Like, it flashes very fast some other iFrame. It appears to be the "You liked:..." dialog/confirm form. Then I get a confirm dialog.

After that the Like link in the like/share plugin changes to an "error" link.

If I click that I get the dreaded (could not resolve object at "http://localhost/."):

Finally with the share button I just get this this: Error, we are working on it.

So with the basics from the FB Developer examples I am using og: meta tags even though I am not using OpenGraph.

But with MVC you have only ONE (1) URL!!! And use controller and routes to manage all calls. So how would I share/like, some some specific content in my site and still use a canonical URL?

I am using JQUERY to set the og:meta tag and the "data-href" in the fb-like iFrame. I just don't think FaceBook likes the MVC url's I am sending it, or I don't have something set-up right?!?

Header: <meta property="og:url" content="http://localhost:6999" /> <meta property="og:type" content="website" /> <meta property="og:title" content="Swartling Family Archive" /> <meta property="og:description" content="Swartling Family Archive" /> <meta property="og:image" content="" />

sdk init:

<script>
  window.fbAsyncInit = function() {
    FB.init({
        appId: '<removed>',
      xfbml      : true,
      version    : 'v2.6'
    });
  };

  (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'));

</script>

JQuery to modify og tags and data-href on the fly. In this case when I load an image into a container. per the docs you are supposed to set them the to the same value. (this is a little messy and need to clean it up):

viewModel.friendlyname(data.ImageFriendlyName);
            // deal with FB meta requirements
            var baseurl = $(location).attr('host');
            var ogurl = 'http://' + baseurl + data.ImageMainPage;
            var thumburl = 'http://' + baseurl + '/thumbnailview/120/120?' + data.ImageMainPage;

            // set fb href if its there, global for now
            var widgetFB = $('div#btnsfb');
            if(widgetFB != null){
                widgetFB.attr('data-href', ogurl);
            }
            //set meta tags
            $('meta[property="og:url"]').attr("content", ogurl);
            $('meta[property="og:image"]').attr("content", thumburl);

ogurl would look something like:

http://localhost:<port>/image?imagevpath=SwartlingFamilyCom%2fEric+Swartling%2ftickets_002.JPG"

and thumburl would look something like this:

http://localhost:<port>//thumbnailview/120/120??imagevpath=SwartlingFamilyCom%2fEric+Swartling%2ftickets_002.JPG"

So, hopefully that gives the picture. Not sure you can provide a canonical URL. If so does this mean that in an MVC app you can only like/share the site? And not any of its particular content? This would be a bummer.

Thanks again for your time in reading and response. You times is much appreciated. If I did not provide any necessary details, please

Cheers

Community
  • 1
  • 1
SwartHack
  • 65
  • 1
  • 8
  • Since this is my first post and have no rep, I had to exclude screen shots that illustrated the error. Interesting policy. – SwartHack Jun 03 '16 at 00:41
  • Facebook will not execute JavaScript. Your OG tags must be rendered in the HTML output, not dynamically with JS. – ceejayoz Jun 03 '16 at 16:52
  • Not sure I understand? I am executing that javascript myself, to update the og: tags before I post to facebook. – SwartHack Jun 04 '16 at 00:21
  • `$('meta[property="og:url"]').attr("content", ogurl);` will affect the page in your browser only. The change doesn't persist to the server, and certainly won't be seen by Facebook's crawler. – ceejayoz Jun 04 '16 at 01:02
  • Ok, then if I understand what you are saying, my site has to have static content? What site uses static content anymore? If you pass my server (ASP.NET/MVC5) a request and parameters, it will respond accordingly by passing back either html or json. – SwartHack Jun 06 '16 at 19:58
  • EDIT: Cant update original because of reputation with more links. Here is what I am working from. My intention is to use the plug-ins only. Not to use OpenGraph. I really don't intend to write any native FB jsSDK code, nor should have to. – SwartHack Jun 06 '16 at 20:10
  • So this page is my core reference point: https://developers.facebook.com/docs/plugins Specifically the Like plugin with the "share" option: https://developers.facebook.com/docs/plugins/like-button Then there is the FB jsSDK: https://developers.facebook.com/docs/javascript/examples which get into the fb.ui, etc. Which I don't want to use. Someone using ASP.NET/MVC5 and Facebook like/share has to be out there. Please help. At this point I am leaving facebook integration behind and moving on. I will monitor/update this post accordingly. – SwartHack Jun 06 '16 at 20:10

0 Answers0