Facebook post redirects to blank page : https://www.facebook.com/dialog/return/close?#_=_

David Geismar picture David Geismar · Nov 20, 2016 · Viewed 7.4k times · Source

I have og tags on one of my page :

  %meta{property:"og:image", content:"https://stars-et-metiers.s3.amazonaws.com/posters/attachments/000/000/990/large/rsz_sm_01_rvb.jpg?1478271329" }
  %meta{property:"og:url", content: votes_url }
  %meta{ property: 'og:description', content: "J’ai voté pour mon lauréat coup de ❤ Stars & Métiers 2016 ! Et vous, quel est votre coup de cœur ? avec lien minimisé vers la page lauréat du site" }

The idea is to tell facebook to actually check the ogs from another page to create the rich post :

 %meta{property:"og:url", content: votes_url }

Thus facebook should actually scrap the ogs from the votes_url path :

%meta{ property: 'og:title', content: "J’ai voté pour mon lauréat Stars et Metiers" }
  / %meta{ property: 'og:url', content: laureates_url }
  %meta{ property: 'twitter:card', content: 'summary' }
  %meta{name:"twitter:title", content: "J’ai voté pour mon lauréat Stars et Metiers"}
  %meta{property:"og:image", content:"https://stars-et-metiers.s3.amazonaws.com/posters/attachments/000/000/990/large/rsz_sm_01_rvb.jpg?1478271329" }
  %meta{property:"og:url", content: votes_url }
  %meta{name:"twitter:description", content:"J’ai voté pour mon lauréat coup de ❤ Stars & Métiers 2016 ! Et vous, quel est votre coup de cœur ?" }
  %meta{ property: 'og:description', content: "J’ai voté pour mon lauréat coup de ❤ Stars & Métiers 2016 ! Et vous, quel est votre coup de cœur ? avec lien minimisé vers la page lauréat du site" }

this is working pretty well as you can see here

I have a facebook "sharing link" on my app :

<a href="http://www.facebook.com/share.php?u=https://staging-starsetmetiers.herokuapp.com/prix-coup-de-coeur-du-public/17722/notification"><div aria-hidden="true" class="fa fa-facebook-square social-icon" id="i"></div>
</a>

When the user clicks on it, it redirects to facebook, and shares the page, but when I click on the rich post on facebook, the redirection doesnt work :

I am redirected to a blank page : https://www.facebook.com/dialog/return/close?#_=_

What is going on here, Why am I not redirected to the correct url ?

Answer

plaidcorp picture plaidcorp · Mar 12, 2018

I don't know why it doesn't return to the correct URL, but I had the same problem and created the below solution:

<a href="#" onclick="fbShareWindowOpen()">
  <span id="fbShareButton">Share this on facebook!</span>
</a>
<script>
  function fbShareWindowOpen() {
    var myWindow = window.open("https://www.facebook.com/sharer/sharer.php?u=www.url-to-share.com/", "", "top=30px,width=200,height=100");
  }
</script>

This will open up a window that will resize correctly to fit the facebook sharer UI. When the link is shared (the share button has been clicked) the new window closes, making for a very clean flow.

I don't know for sure, but I assume the facebook sharer child window is closed by the "..return/close.." redirect URL.