N
N
nick88hello2015-07-01 13:14:08
JavaScript
nick88hello, 2015-07-01 13:14:08

Vkontakte API: why doesn't the widgets.like.shared event fire?

Tell me why the widgets.like.shared event handler (make a repost) does not work? There are no errors in the console, reposts appear on the wall, but the alert does not pop up!

<html>
    <head>
        <script src="http://vk.com/js/api/openapi.js?105" type="text/javascript"></script>
        <script type="text/javascript" src="http://vk.com/js/api/share.js?90" charset="windows-1251"></script>
        <script type="text/javascript">
            VK.init({ apiId: ******* , onlyWidgets: true });
        </script>
    </head>
    <body>
        <div id="vk_like"></div>
<script type="text/javascript">
 
      document.getElementById('vk_like').innerHTML = VK.Share.button({
                        type: 'button', text: 'Опубликовать',noparse: true
                    });
 
      VK.Observer.subscribe('widgets.like.shared', function f(shareCount){
            alert(shareCount);
       });
 
</script>
    </body>
</html>

The handler is triggered only if it is forced to be called:
setTimeout('VK.Observer.publish("widgets.like.shared",8)', 4000);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question