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!