Google plus徽章未显示

时间:2014-06-08 17:45:03

标签: javascript html html5 google-plus

我在Google plus开发者身上创建徽章:https://developers.google.com/+/web/badge/ 但是当我将代码复制并复制到我的HTML文件中时,徽章没有显示。这是我的代码:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Google + Badge</title>
  </head>
  <body>

    <!-- Place this tag where you want the widget to render. -->
    <div class="g-page" data-href="https://plus.google.com/109600806421917664383" data-rel="publisher"></div>

    <!-- Place this tag after the last widget tag. -->
    <script type="text/javascript">
      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/platform.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
    </script>


  </body>
</html>

我做错了什么!感谢

1 个答案:

答案 0 :(得分:0)

adeneo's JSFiddle也不适合我(Chrome 35,OSX)。首先,我必须在Disconnect extension中将其列入白名单。然后我收到了控制台错误

Uncaught ReferenceError iframes is not defined

,根据http://www.jesse-smith.net/fixed-google-plus-1-button-working/Google PlusOne Button has errors on Chrome,是由于第三方Cookie被屏蔽造成的。

如果您也在使用Chrome(并且通过阻止第三方Cookie也会导致问题),则网址栏的右侧应该有一个Cookie图标。点击它,点击“显示Cookie和其他网站数据...”,切换到“已屏蔽”标签,并允许来自* .google.com域名的所有第三方Cookie。

你也可以去设置&gt;显示高级设置&gt;隐私,点击“内容设置”按钮,即可在任何地方启用第三方Cookie。

很遗憾,我无法找到让G +按钮在禁用第三方Cookie的浏览器中工作的方法。

相关问题