当我使用时
var
values =某个数组取决于用户选择。
document.cookie = "filters="+values;
如果路径为/ abc-def /
,如何设置此cookie的路径答案 0 :(得分:2)
试试这个:
document.cookie="name=value;path=/";
答案 1 :(得分:1)
您可以使用
values = JSON.stringify(values); document.cookie =" filters =" + values;
答案 2 :(得分:0)
这将为您提供更多帮助
$.cookie("test", 1, {
expires : 10, //expires in 10 days
path : '/', //The value of the path attribute of the cookie
//(default: path of page that created the cookie).
domain : 'google.com', //The value of the domain attribute of the cookie
//(default: domain of page that created the cookie).
secure : true //If set to true the secure attribute of the cookie
//will be set and the cookie transmission will
//require a secure protocol (defaults to false).
});