【问题标题】:Get if linked succefully shared with google plus share button获取链接是否成功与 google 共享以及共享按钮
【发布时间】:2025-12-31 04:30:10
【问题描述】:

我需要获取 url 是否在 google plus 中成功共享。请注意,如果用户单击共享按钮然后关闭气泡是不够的。我需要确定共享链接以在我的应用程序中执行特定逻辑。

有什么理由这样做吗? onend interaction函数的“url”参数中是否有我需要查找的文件?

【问题讨论】:

    标签: google-plus


    【解决方案1】:

    这是一个示例,演示如何将 onendinteraction 与 Google+ 分享按钮一起使用。

    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
    <script type="text/javascript">
            function startInteraction(params) {        
                window.console.log('end interaction');
            };
    
            function endInteraction(params) {
                window.console.log('end interaction');
            };
    </script>
    
    <g:plus action="share" href="http://example.com" onstartinteraction="startInteraction" onendinteraction="endInteraction"></g:plus>
    

    【讨论】: