facebooklocalhostsharefb.ui

Facebook share data-href not sharing localhost content


I am developing a website in localhost and I want to have a Facebook share button which shares a page of my website. For now the page I would like to share is only local.

The share button works fine when href in FB.ui has a public available URL. It lets me share content even whit other URLs (e.g. dev.myapp.com/mypage) but this content does not appear on Facebook (probably because Facebook detects that this page does not exists (yet) in the web.

Funny stuff is, if I use the Facebook share button (the one provided by facebook) the content is posted even if it is only local.

So, is there a way to share local content while we are under development?


Solution

  • You have 2 options:

    1. Add localhost:xxxx as your site URL and localhost as one of your approved app domains. You can only have 1 site URL, so you may need the second option if your app is in production...
    2. Or create 2 apps, one for production and one for development, with different site URLs and different domains.

    In both cases, you have to be on developers.facebook.com on your app page > settings > Add platform > website.