Facebook像HTML5 Canvas [英] Facebook Like HTML5 Canvas

查看:265
本文介绍了Facebook像HTML5 Canvas的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道用户生成的HTML5画布是否可以附加到Facebook的喜欢动作并在Facebook墙上分享?

Does anyone know if a user generated HTML5 Canvas could be attached to a Facebook 'Like' action and shared on a Facebook wall?

要呈现到< img> 标记和在 og:image 元数据中指定的标记的ID?

I guess the canvas would have to be rendered to an <img> tag and the id of the tag specified in the og:image metadata?

推荐答案

我有两个选择。

1)使用 Like按钮,并在其中放置动态网址,生成og用户选择的配置的标签。
在like按钮教程的第二步,它为您生成og标签,以便您可以看到所需要的,然后只是确保您的服务器根据用户配置生成那些标签。
当用户完成配置后,您必须从您的页面向服务器发出请求,以便可以进行此操作。

(1) Use the Like Button and in it put a dynamic url which generates the og tags for the configuration the user has chosen. In the 2nd step of the like button tutorial it generates the og tags for you so you can see what's needed, then just make sure that your server generates those according to what the user configured. You'll have to make a request from your page to the server when the user finished his configuration so that this will be possible.

(2)使用js sdk附带的 Feed对话
使用它可以指定所有的故事字段,例如:

(2) Use the Feed Dialog that comes with the js sdk. Using that you can specify all of the story fields, for example:

var obj = {
    method: "feed",
    picture: "URL_FOR_THE_CONFIGURED_BIKES_PIC",
    name: "My custom bikes!",
    caption: "I just finished building a new pair of bikes",
    description: "My configuration: ....."
};

FB.ui(obj, function(response) {
    console.log(response);
});

当然,如果每个配置都有一个特定的URL,那么你可以简单地:

It is of course possible to mix both options into a third, if you have a specific url per configuration then you can simply:

FB.ui({
    method: "feed",
    link: "URL_FOR_THE_USER_CONFIGURATION"
}, function(response) {
    console.log(response);
});

然后Facebook会从该链接中的og标签中提取数据。

And then facebook will extract the data from the og tags in that link.

这篇关于Facebook像HTML5 Canvas的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆