[英]How can I share image in facebook in firefox of using javascript?
I have an image generated from canvas. 我有一个从画布生成的图像。
var image = canvas.toDataURL("image/png");
Now I want to share it in facebook. 现在我想在facebook上分享。 How can I do it for firefox os using javascript.
我如何使用javascript在Firefox OS中做到这一点。 I am very new.
我很新。 I search a lot but unfortunately I did not get any results.
我搜索了很多东西,但不幸的是我没有得到任何结果。
To share your image is recommended to use the WebActivities allowing you to interact with other applications, for example, share a picture or text ... 若要共享图像,建议使用WebActivities允许您与其他应用程序进行交互,例如,共享图片或文本...
Below I leave a simple code to implement it and share your image, you must specify that it is an image and pass it as a blob. 在下面,我留下了一个简单的代码来实现它并共享您的图像,您必须指定它是图像并将其作为Blob传递。
blobCanvas.width = imgToShare.width;
blobCanvas.height = imgToShare.height;
// Get context and draw image
var blobCanvasContext = blobCanvas.getContext("2d");
blobCanvasContext.drawImage(imgToShare, 0, 0);
// Export to blob and share through a Web Activitiy
blobCanvas.toBlob(function (blob) {
new MozActivity({
name: "share",
data: {
type: "image/*",
number: 1,
blobs: [blob]
}
});
});
I recommend you read more about WebActivities in the MDN 我建议您阅读有关MDN中的WebActivities的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.