javascript - How to determine if the user is currently logged in and visits the current page for the first time?
为情所困
为情所困 2017-05-19 10:06:52
0
1
501
  1. 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.

  2. 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

为情所困
为情所困

reply all(1)
为情所困

Isn’t it enough to set the domain of the cookie to:.segmentfault.com?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!