简体   繁体   English

Facebook赞按钮与预先填写的评论

[英]Facebook Like Button with prepopulated Comment

I've got a page with a table of items that the user can select. 我有一个页面,其中包含用户可以选择的项目表。 I'd like to add a facebook LIKE button. 我想添加一个facebook LIKE按钮。

When the user clicks the like button, it will popup the comment box, which I'd like to be helpfully prepopulated comment based on the items the user has clicked. 当用户点击“赞”按钮时,它会弹出评论框,我希望根据用户点击的项目帮助预先填充评论。 They can change it if they wish, or they can just leave it as is. 如果他们愿意,他们可以改变它,或者他们可以保持原样。 It would say something like "I like Item-1 and Item-4", if those table rows were selected. 如果选择了那些表行,它会说“我喜欢Item-1和Item-4”。

Is it even possible to pre-populate the comment field? 是否可以预先填充评论字段?

If so, is it possible to change it via javascript each time the user changes their selection? 如果是这样,每次用户更改选择时,是否可以通过javascript更改它?

It is not possible to pre-populate the comment field of the Like Button, as it must be user generated. 无法预先填充Like按钮的注释字段,因为它必须是用户生成的。 However, you can create unique URLs for each table row that will generate unique content in the like button story to represent the item the user liked. 但是,您可以为每个表行创建唯一的URL,这些URL将在类似按钮故事中生成唯一内容,以表示用户喜欢的项目。 For Example: 例如:

<fb:like href="http://www.example.com/example.php?row=row1"></fb:like>
<fb:like href="http://www.example.com/example.php?row=row2"></fb:like>

The OG meta data associated with each unique URL should represent the item information for that row. 与每个唯一URL关联的OG元数据应表示该行的项目信息。 Example: 例:

<meta property="og:title" content="Row 2 Item"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.example.com/example.php?row=row2"/>
<meta property="og:image" content="http://www.example.com/example_row2.jpg"/>
<meta property="og:site_name" content="example"/>
<meta property="og:description" content="Information about item at row 2"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM