The system has two login pages, one is a pop-up window and the other is a comprehensive login portal.
1.1 The page is under www.segmentfault.com, and the pop-up window must be under www.segmentfault.com.
1.2 Comprehensive login portal login.segmentfault.com.
My own tried solution
2.1 Using the localstroage solution, the comprehensive login portal cannot record the login status
2.2 Get the status when entering the page and clear the status when logging out. But what if the status is not cleared? Definitely not.
2.3 I just had a sudden idea to get the sessionid in the cookie. This way I can identify unique sessions by the state in the background. Then you can determine whether it is repeated in this session. But I found that there was no document.cookie in it. I am an old person.
2.4 document.referrer, if document.referrer is login.segmentfault.com, it will be considered a new login
Isn’t it enough to set the domain of the cookie to:
.segmentfault.com
?