Twitter callback Web Intents Javascript Events

你说的曾经没有我的故事 提交于 2019-12-08 06:33:19

问题


Is it possible to pass some variables to the called function,

it tried it like this but failed

<script type="text/javascript">
twttr.ready(function (twttr) {
twttr.events.bind('tweet', twitnshare('tws_likings', '<?php echo $sess_uid;?>', href));
});</script>

If its not possible, whats the way out.


回答1:


Question answered in place on our dev forums: https://dev.twitter.com/discussions/671




回答2:


Usually if the events binding is not working i have found ppl missing the assign to windows.twttr before binding an event to it. First do this :

window.twttr = (function (d,s,id) {
  var t, js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return; js=d.createElement(s); js.id=id;
  js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs);
  return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
}(document, "script", "twitter-wjs"));

Than do the bindings:

twttr.ready(function (twttr) {
twttr.events.bind('tweet', function (event) { //add ur post tweet stuff here } );
});

Following links might help : https://dev.twitter.com/docs/intents/events#events

https://dev.twitter.com/discussions/671



来源:https://stackoverflow.com/questions/9846651/twitter-callback-web-intents-javascript-events

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!