About share a random quote on facebook

About share a random quote on facebook
0

#1

I am struggling with the Random Quote challenge, I want to share the quote on Facebook.

I have read the tutorial on how to share content on Facebook.

Here is my Codepen link:https://codepen.io/sarah870102/pen/YYQGBW

I have added the code after tag in HTML file.

  <script>
                window.fbAsyncInit = function() {
                  FB.init({
                    appId            : '391829624599579',
                    autoLogAppEvents : true,
                    xfbml            : true,
                    version          : 'v2.11'
                  });
                };
              
                (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 = "https://connect.facebook.net/en_US/sdk.js";
                   fjs.parentNode.insertBefore(js, fjs);
                 }(document, 'script', 'facebook-jssdk'));

what’s more, I have added the code to the JS file.

FB.ui({
                method: 'feed',
                caption:'share the quote',
                description:currentQuote + currentAuthor,
                },function(response){});

However, the Facebook button does not work. Is there something wrong? Please give me some help, thanks a lot!


#2

Based on the following forum post, it may not be possible to use this code on Codepen.


#3

I have read the Facebook API, and I found I can’t share plain text to timeline without a URL link.

“The link attached to this post. With the Feed Dialog, people can also share plain text status updates with no content from your app; just leave the link parameter empty.” - from the FaceBook API.

I don’t know whether my conclusion is right? If I am wrong, how can I share plain text from my web to Facebook?