我有一个用户身份验证网页,使用下面的代码使用javascript设置cookie . 它在桌面版Safari上工作正常,但在iOS上使用移动Safari时(我在iOS6和iOS7上测试过),cookie只会在移动Safari应用程序终止之前一直存在 . 我可以使用Safari的调试菜单中的Web检查器来查看cookie最初设置为未来5年的过期日期,而我的其他网页可以读取cookie没问题,但是如果我重新启动手机或退出移动设备Safari并重新启动相同的检查器,显示没有cookie和我的网页 . 我似乎没有其他网站设置的cookie的麻烦 . 谁看过这个吗?可能是什么导致了这个?

<head><title>Authenticate</title>
<script type="text/javascript">
function setCookie(c_name,value,expiredays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()+ "; path=/;"); 
    document.cookie="expiration"+ "=" +escape(exdate.toGMTString())+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()+ "; path=/;"); 
}
</script>
<script type="text/javascript">
var address=prompt("Please enter the code:","")
if (address!=null && address!="")
{
    setCookie('address',address,(365 * 5));
    window.history.go(-2)
} else {
    document.write("There was a problem setting the cookie.")
}
</script>
</head>
<body>
</body>