I have a php-based system, there is no problem in chromeda, but it does not keep cookies in safari, what should I pay attention to in the cookie system for safari, how do I solve this problem?
Deleting cookies when Safari is closed and opened
Same-Site attribute: Safari has strict policies regarding cross-site tracking. If you want your cookie to be accessed by third-parties set SameSite=None
. If you want your cookies to be accessed only by your site, SameSite=Lax
or SameSite=Strict
can be used. Try different values and see how it affects your cookie on safari.
If your cookie is set with SameSite=None
, Safari requires that the cookie is also marked with Secure
, meaning it can only be transmitted over HTTPS
.
Setting HTTPOnly
can enhance cookie security by preventing client-side scripts from accessing the cookie. Although we do not know whether safari considers this.
Be sure to explicitly set a cookie expiration date
Be sure the Path
and Domain
of your cookie are correct
Safari has adjusted cookie handling on different versions of the browser. Test how your cookies are handled on different versions of safari.
Safari has privacy features that can prevent JavaScript from from accessing cookies. If your using JavaScript to manipulate the cookie, safari may be blocking it.
Use Safari's developer tools to inspect the cookies being set.