問題描述
所有這些網絡平台如何實現不需要用戶反复登錄的長時間登錄會話? (How do all these web platforms achieve a long-time login session that does not require the user to login over and over again?)
I really don't get that: Some platforms have some kind of "persistent" login sessions. Like Stackoverflow and many other boards and platforms. I've logged in here a month ago. And even if I quit my browser totally and have another internet connection with different IP, I come back here with no login.
I can't belief that's just done with cookies, since cookies are not accepted in most modern browsers anymore (they would ask the user and the click instinctive "no").
I even encountered a platform that does persistent login regardless of the browser I use. I could use safari, or opera. No matter what. I was always logged in with my nick.
Since a few years have passed since that and I went totally off from web development, I wonder if technologies have changed? How is that done today?
參考解法
方法 1:
I can't belief[sic] that's just done with cookies, since cookies are not accepted in most modern browsers anymore (they would ask the user and the click instinctive "no").
Every major browser accepts cookies by default.
(Just another example of the golden rule of rationality: Beliefs do not substitute facts.)
方法 2:
Most browsers are configured to accept first-party cookies by default - these are cookies supplied by a website for the same domain. However, a third party cookie, one sent by one site, but destined to be used on another, will often be rejected or pop open a confirmation dialog.
So the answer is, yes, it is cookie!
There's some interesting graphs here showing the percentage of visitors to one site who have various forms of cookie filtering enabled, broken down by browser:
The same site also has a summary of the capabilities and defaults for cookie handling in the major browsers.
方法 3:
Cookies make the world go round.
方法 4:
so... it seems you have your answer (or at least part of it), but I thought I'd add the detail (though I suspect you already know this), that you can set a cookie to expire at some point in the distant future, effectively making it permanent.
方法 5:
You can easily check that StackOverflow stores cookies in your browser.
(by Thanks、phihag、Paul Dixon、Robin Day、Yevgeny Simkin、esycat)