需求
點擊第三方登陸-->打開新tab並控制tab大小-->新tab登陸完成自動關閉-->通知舊tab刷新javascript
難點一 如何經過js新建tabhtml
<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默認會阻止彈窗html5
難點二 如何關閉tabjava
window.opener = null; window.open('', '_self'); window.close();
難點三 如何跨tab通訊git