发布于 2年前
第三方登录弹窗效果
点击第三方登录-->打开新tab并控制tab大小-->新tab登录完成自动关闭-->通知旧tab刷新
1、 通过js新建tab
<a class="3rdLogin" href="/a/b/c">click to login</a>
$(".3rdLogin").click(function(e) {
e.preventDefault(),
window.open($(this).attr("href"), "_blank", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500")
})
如果直接用window.open(),在chrome默认会阻止弹窗
2、 如何关闭tab
window.opener = null;
window.open('', '_self');
window.close();