【问题标题】:+1 button is unavailable or has stopped working+1 按钮不可用或已停止工作
【发布时间】:2012-03-22 18:41:39
【问题描述】:

我在同一个 wordpress 页面中有 3 个 google +1 按钮。但是其中一个在单击时失败(在然后浮动横向小部件中)显示exclamation mark

再次点击会打开以下页面: +1 button is unavailable or has stopped working. 我很确定所描述的可能原因都不会发生。

两者的代码实际上是相同的:

// float code (malfunction)
<div id="float_plusone">
<g:plusone size="tall" href="<?php echo urlencode(get_permalink()); ?>" count="true"></g:plusone>
</div>
<script type="text/javascript">
(function() {
var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;
po.src = "https://apis.google.com/js/plusone.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);
})();
</script>

// above/below posts code (works)
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<g:plusone size="medium" callback="googleplus_click"></g:plusone>

欢迎提出任何建议。

【问题讨论】:

    标签: javascript wordpress google-plus social


    【解决方案1】:

    这是按钮向服务器发送 +1 的 URL。

    "id":"http://bestpushchairs.net/qc21/disclosure-policy/http%3A%2F%2Fbestpushchairs.net%2Fqc21%2Fdisclosure-policy%2F"
    

    看起来按钮正在使用href 值并假设它是相对于当前路径的。尽量不要使用urlencode

    【讨论】:

    • +1 我完全删除了href="&lt;?php echo urlencode(get_permalink()); ?&gt;"。现在工作。谢谢!
    猜你喜欢
    • 2014-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多