javascript - Google+ JS API trigger the interactive post button automatically -
i'm using google+ api. can render 'interactive post' button javascript described here: https://developers.google.com/+/web/share/interactive#rendering_the_button_with_javascript
so, code looks this:
var options = { contenturl: myurl, clientid: myclientid, cookiepolicy: 'single_host_origin', prefilltext: sometext, recipients: somerecipients, calltoactionlabel: 'view', calltoactionurl: myurl }; gapi.interactivepost.render('gplus-share-trigger', options);
but want trigger button automatically when finished rendering, there way detect that? dont want ugly like:
settimeout(function(){ $('#gplus-share-trigger').click(); },500);
thanks
use:
var options = { contenturl: myurl, clientid: myclientid, cookiepolicy: 'single_host_origin', prefilltext: sometext, recipients: somerecipients, calltoactionlabel: 'view', calltoactionurl: myurl, callback: function(result) { $('#gplus-share-trigger').trigger("click"); } };
Comments
Post a Comment