我使用@Anywhere为我的网站创建了自定义的Twitter登录按钮。我的问题是我想手动关闭twitter登录弹出窗口,因为我的弹出窗口不会自动关闭,因为它重定向到我提供的URL并且没有关闭。
以下是我工作的代码:
twttr.anywhere(function (T) {
var currentUser,
screenName,
profileImage,
profileImageTag;
document.getElementById("tweet").onclick = function () {
T.signIn();
};
T.bind("authComplete", function (e, user) {
window.location.reload();
});
if (T.isConnected()) {
currentUser = T.currentUser;
var add = currentUser.data('name'); //Getting user name from its twitter account
var n = add.split(" ");
document.getElementById('firstName').value = n[0];
alert(document.getElementById('firstName').value);
document.getElementById('LastNm').value = n[1];
//T("#twitter-connect-placeholder").connectButton();
twttr.anywhere.signOut();
} else {
//T("#twitter-connect-placeholder").connectButton();
/* Making the text box value empty*/
document.getElementById('firstName').value = "";
document.getElementById('LastNm').value = "";
/* Making the text box value empty*/
};
});