简体   繁体   中英

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.

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.

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?

It is not possible to pre-populate the comment field of the Like Button, as it must be user generated. 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. 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. 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"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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