[英]Google Plus share and Sign in with Google plus disappeared
我已经在我的网站上使用google plus登录了。 它运行良好,并根据官方教程( https://developers.google.com/+/web/signin/ )进行了实现
class="g-signin"
data-callback="onSignInCallback"
data-clientid=<my id>
data-approvalprompt="force"
data-width="wide"
data-cookiepolicy="http://<?php echo $c_site; ?>.com"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email">
</span>
几个星期前,相应的js客户端在官方网站上被作为示例进行了编码。 同时,我在Google+上的分享按钮也消失了。 这也是根据官方网站https://developers.google.com/+/web/share/进行的工作和编码
<div class="g-plus" data-action="share" data-annotation="none" displayText="<?php echo $someBullshit;?>" data-href="<?php echo $url;?>" ></div>
我在这里不做详细介绍,因为我的代码是逐字逐句地从教程中复制而来的。 有人在这里看到明显的东西吗? g + API是否有重大变化? 教程似乎没有变化
也许您的plusone.js发生了什么变化? 确保这是在您的页面上,紧接您的结束标记之前:
<!-- Place this asynchronous JavaScript just before your </body> 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/client:plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
要测试它是否已加载,请打开JavaScript控制台并测试是否存在gapi对象:
gapi.plus.render
其次,看起来您的容器(跨度)没有开头标签。 它应显示为:
<span class="g-signin"
data-callback="onSignInCallback"
data-clientid=<my id>
data-approvalprompt="force"
data-width="wide"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email">
最后,请注意设置cookiepolicy的方式。 如果配置不正确,脚本将被阻止加载。 尝试将其更改为single_host_origin,以查看其设置是否不正确(通常应为http://yoursite.com或https: //yoursite.com,https和http会有所不同)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.