谷歌+分享和onendinteraction - 没有确认

Joh*_*lly 5 javascript google-plus

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

窗口关闭时调用我的函数,但实际共享链接时不调用:

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>
Run Code Online (Sandbox Code Playgroud)

我的函数redirectGooglePlus只在hover类型时被调用,而且永远不会confirm(这是应该表示共享的那个).

有谁知道为什么不调用该函数confirm

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

Joh*_*lly 1

因此,这似乎是 google+ 共享按钮当前实现的一个错误:

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

我现在使用的(可怕的)解决方法是寻找 2 个悬停事件onendinteraction。如果事件连续发生(少于 1 秒),那么他们很可能已经共享了该项目。