0
當在GitHub網站上打開多個標籤頁/窗口時,如果您碰巧登錄/註銷其中一個標籤,您會收到所有其他消息的通知,邀請您重新加載以刷新會話狀態。GitHub如何檢測登錄/註銷?
這是怎麼做的?
我所知道的,到目前爲止是HTML代碼中包含有通過JavaScript激活一些隱藏的SVG圖形+跨頁:
<div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
<svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"></path></svg>
<span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>
<span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>
</div>
也許他們反覆檢查一個cookie。或者註銷標籤向其他人註銷註銷信息。或者是其他東西。 – Bergi
通過https://live.github.com/_sockets /上的websocket ... – immobiluser