What can cause a cookie not to be set on the client?

后端 未结 3 857
抹茶落季
抹茶落季 2020-12-15 23:12

I have a web application that uses jQuery.ajax to perform a request to another host (right now actually the same because I\'m using different ports of \"localhost\"). The se

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-15 23:54

    where do you get the date from?

    if you add it manually try making it failproof

    var exdays = 3; //3 days valid as an example
    var exdate=new Date();
    exdate.setDate(exdate.getDate() + exdays);
    //Now set the cookie to said exdate
    document.cookie = "MyUserSession =" + escape(JxQoyzYm1VfESmuh-v22wyiyLREyOkuQWauziTrimjKo=)+"; expires="+exdate.toUTCString());
    

提交回复
热议问题