我试图在用户关注我之后调用一个函数,这似乎在桌面上工作得很好。但是在移动设备上,因为弹出窗口打开了一个新的选项卡,而不是像在桌面上那样打开一个弹出窗口,它不会捕获回调。有什么想法吗?
<script>
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
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"));
twttr.ready(
function(twttr) {
twttr.events.bind(
'follow',
function(event) {
var followedUserId = event.data.user_id;
if (followedUserId == "1234567890") {
console.log("Following Twitter account.");
}
}
);
twttr.events.bind(
'unfollow',
function(event) {
var followedUserId = event.data.user_id;
if (followedUserId == "1234567890") {
console.log("Unfollowing Twitter account.");
}
}
);
}
);
</script>