我正在设置一个 google+ 分享按钮,并想知道何时有人分享了该链接,以便我可以执行操作。您可以使用以下命令在共享按钮上注册回调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>
我的功能redirectGooglePlus
仅当hover
类型,并且从不confirm
(这应该表明股份已经完成。
有谁知道为什么不调用该函数confirm
?
仅供参考,谷歌共享文档在这里:https://developers.google.com/+/web/share/ https://developers.google.com/+/web/share/
因此,这似乎是 google+ 共享按钮当前实现的一个错误:
https://code.google.com/p/google-plus-platform/issues/detail?id=396 https://code.google.com/p/google-plus-platform/issues/detail?id=396
The (hideous)我现在使用的解决方法是寻找 2 个悬停事件onendinteraction
。如果事件连续发生(少于 1 秒),那么他们很可能已经共享了该项目。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)