Preface
A few weeks ago, I encountered some problems related to cookies at work. Before that, I thought to myself: “Cookies are just like that. Even if some attributes are not familiar, just search for information online. There are no difficult problems related to cookies, right?”
However, the fact proved me wrong. I really encountered a cookie problem that took me a long time to solve.
I believe that many people are eager to try it when they see this. So let me ask you first:
Under what circumstances will cookies not be written?
Obvious syntax errors don’t need to be mentioned. In addition to this, you may answer: writing cookies for a completely different domain. For example, your webpage is on http://a.com
, but you insist on writing cookies for http://b.com
. Of course, cookies cannot be written in this situation.
Or, you may answer: adding the Secure
flag to cookies that are not on https. Yes, cookies in this situation cannot be written either.
Can you think of anything else?
If you can’t think of anything, let me tell you!