谷歌+分享和onendinteraction - 没有确认 [英] google+ share and onendinteraction - no confirm

查看:111
本文介绍了谷歌+分享和onendinteraction - 没有确认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置谷歌+分享按钮,想知道有人分享链接的时间,以便我可以执行操作。您可以使用 onendinteraction 属性在共享按钮上注册回调,并且文档说明只要共享框关闭以及共享完成,就会调用此回调。 / p>

我的功能在窗口关闭时被调用,但在链接实际共享时却没有被调用:

  function redirectGooglePlus(jsonParam){
alert(jsonParam.type);
}
< div class =g-plusdata-action =sharedata-annotation =vertical-bubbledata-height =60
data-href = http://mywebsite.comdata-onendinteraction =redirectGooglePlus>< / div>

我的功能 redirectGooglePlus 只在悬停类型,永远不会确认(这是表示该共享已完成的那个。



有没有人知道为什么不用确认调用该函数?



仅供参考谷歌分享文档:
https://developers.google.com/ + / web / share /

解决方案

所以这似乎是当前谷歌+分享实施的一个错误按钮:



https://code.google.com/p/google-plus-platform/issues/detail?id=396



hideous )我现在使用的解决方法是为 onendinteraction 查找2个悬停事件。如果事件发生在quic中k继承(不到1秒),那么很可能他们已经分享了这个项目。


I'm setting up a google+ share button, and want to know when someone has shared the link so that I can perform an action. You can register a callback on the share button using the onendinteraction attribute, and the documentation states that this will be called whenever the share box is closed and whenever the share is completed.

My function is being called when the window is closed, but not when the link is actually shared:

function redirectGooglePlus(jsonParam) {
    alert(jsonParam.type);
}
<div class="g-plus" data-action="share" data-annotation="vertical-bubble" data-height="60"
                 data-href="http://mywebsite.com" data-onendinteraction="redirectGooglePlus"></div>

My function redirectGooglePlus is only ever called when the hover type, and never confirm (which is the one that is supposed to signify the share has been completed.

Does anyone know why the function isn't called with confirm?

FYI the google share documentation is here: https://developers.google.com/+/web/share/

解决方案

So this appears to be a bug with the current implementation of the google+ share button:

https://code.google.com/p/google-plus-platform/issues/detail?id=396

The (hideous) workaround I've used for now is to look for 2 hover events for the onendinteraction. If the events come in quick succession (less than 1 second), then it's likely they've shared the item.

这篇关于谷歌+分享和onendinteraction - 没有确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆