This is a very popular question and contains overwhelming zero answers on the Internet.
I have a canvas translated into blob that I want to post to Facebook.
How to achieve this, briefly?
Here is what I have developed so far:
var myCanvas = document.getElementById("myCanvas")
function shareOnFacebook() {
myCanvas.toBlob(function(blob) {
var form = new FormData();
form.append('newFlagPic', blob, '.png');
console.log(form)
FB.api(
"/me/photos",
"POST",
{
"source": form
},
function (response) {
if (response && !response.error) {
console.log("Success bud")
}
}
);
});
};
I find it absolutely insane that fb does not provide sample code for this, as this is clearly such a commonly used use case. I read various answers in the last 5 hours, and not one of them addresses this fb method.
source
share