javascript - 从 Google +1 按钮共享时指定图像

标签 javascript jquery google-plus google-plus-one

在这个链接中,我学会了为 Google +1 按钮指定一个 URL。

specify custom url to gplus one button .

我还可以指定特定图片吗?

已编辑

我不需要更改 Google 加号按钮 gif 或 Google 加号按钮的背景。我需要指定用户想要在社交网络中分享的图像。

可能吗?

最佳答案

是的,这是可能的。

您的意思是您想要指定一张图片,该图片将显示在通过在 Google+ 上分享而生成的代码段中。 +1 按钮有两个作用:1) 点击后会在计数中添加 +1,以及 2) 用户可以选择将您的网址分享到 Google+ 并对其发表评论。

您要问的是该交互的第二部分,记录在 https://developers.google.com/+/plugins/snippet/

该页面有一个工具可以帮助您生成需要插入到页面中的 HTML。您还可以选择三种不同的方法来指定片段信息。

使用 schema.org 标记的示例:

<!-- Update your html tag to include the itemscope and itemtype attributes. -->
<html itemscope itemtype="http://schema.org/Article">

<!-- Add the following three tags inside head. -->
<meta itemprop="name" content="My Cool Article">
<meta itemprop="description" content="This is the greatest site ever">
<meta itemprop="image" content="http://example.com/mycoolimage.png">

关于javascript - 从 Google +1 按钮共享时指定图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13307146/

相关文章:

javascript - 在reactjs中使用按钮创建显示和隐藏部分

javascript - 使用密码栏和 regExp Angular using 指令中的特殊字符进行密码验证

jquery - 如何向 UI 选项卡添加淡入淡出效果?

javascript - 使用 AJAX 搜索 API

google-plus - 将 google 添加到 IAM 的身份提供商 OpenID Connect

javascript - 防止按键冒泡以在捕鼠器中输入

javascript - 动态 child 正在扩大 parent 的宽度

javascript - 通过远程按钮激活 JQuery UI 日期选择器

使用 AWS Cognito、Google+ OAuth 和 AccountManager 的 Android 应用程序

javascript - Google+ 登录 - 页面仅供登录用户访问