I have used below script to enable tweet/retweet/favorite tweet post. I need to close the pop up automatically once action is completed.I have used Twitter web intent code for this but this is not closing pop up even after action is competed. is there any way to do same.
<script type="text/javascript">
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
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);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
// Define our custom event handlers
function tweetIntentToAnalytics (intentEvent) {
if (!intentEvent) return;
window.close();
window.location.reload();
}
function favIntentToAnalytics (intentEvent) {
if (!intentEvent) return;
window.close();
window.location.reload();
}
function retweetIntentToAnalytics (intentEvent) {
if (!intentEvent) return;
window.close();
window.location.reload();
}
// Wait for the asynchronous resources to load
twttr.ready(function (twttr) {
// Now bind our custom intent events
twttr.events.bind('tweet', tweetIntentToAnalytics);
twttr.events.bind('retweet', retweetIntentToAnalytics);
twttr.events.bind('favorite', favIntentToAnalytics);
});
</script>
HTML CODE
<div class="action_bot">
<a href="https://twitter.com/intent/tweet?in_reply_to=XXX">reply</a>
<a href="https://twitter.com/intent/retweet?tweet_id=XXX">retweet</a>
<a href="https://twitter.com/intent/favorite?tweet_id=XXX">favorite</a>
</div>