javascriptfacebook-sharer

Facebook Share Dialog/Feed Dialog and custom captions/descriptions


Similar questions have been asked on SO regarding Facebook deprecating caption and description parameters in its Share and Feed modules that makes it impossible to, for example, create a 'Share your quiz score' button on a simple quiz page that uses completely client-side implementation of javascript to calculate user's score based on a number of correct answers.

The only parameters that Facebook seems to take into consideration when sharing a specific URL are Open Graph tags. So my question is, using simple Javascript to modify the Open Graph og:title and og:description tags after a user finishes answering all questions and is presented with the final score, will triggering the Facebook's Share/Feed module parse this newly modified tags and generate the share/feed dialog accordingly or will Facebook's Debugger simply cache the initial Open Graph tags when indexing the page for the very first time and ignore the tag change by Javascript?

Would this be considered an 'appropriate' way to implement the 'share your score on Facebook' functionality when there is no dedicated page for each and every user's score that can be shared?


Solution

  • This is not an answer to the question I asked, however, my end goal was the ability to specify a custom text in the Share/Feed dialog and what makes that possible is Facebook's Share Dialog's quote parameter that I originally missed due to some answers to similar questions on SO saying this parameter no longer works. However, I have just tested it and it works as of 23.02.2020.

    So for future readers, you need to specify this parameter in following format:

    https://www.facebook.com/dialog/share?
      app_id=YOUR_APP_ID
      &display=popup
      &quote=QUOTE_TEXT
      &href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
      &redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer