My persistent cookies are being deleted when I close and reopen the browser on iOS Safari (and Chrome). I\'m on iOS 11, but have tested on iOS10/9 also. The cookies persist
I've just come across this problem with cookies being persistent on Android / Desktop devices but not on iOS11 when tested on a production server. The solution seemed to be defining the domain of the cookie:
setCookie = function(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";domain=" + window.location.hostname + ";path=/";
}
setCookie("test", "random test value", 365);
iOS11 seems to be much more locked down in terms of what cookies it accepts. I can find lots of marketing blurb about it being better for privacy but very little technical detail about how to implement things (e.g. persistent login / SSO) properly in light of the new restrictions. Can anyone recommend any useful links?