开发者

How can I set a unique cookie for each website domain

开发者 https://www.devze.com 2023-04-02 00:21 出处:网络
Having a problem with conflicting cookies when I switch domains. How can I set a unique cookie for each website domain with:

Having a problem with conflicting cookies when I switch domains. How can I set a unique cookie for each website domain with:

var $tabs = $("#tabs").tabs({
    cookie: {
        name: 'tab_cookie',
        expires: 7,
    },
    fx: { 
        opacity: 'toggle', 
        duration: 'fast'
    }
});

If possible I would like this to work in the local development envir开发者_Go百科onment using localhost. E.g: http://localhost/cms1


You can set the domain and path in the cookie option, e.g.

var $tabs = $("#tabs").tabs({
    cookie: {
        domain: 'localhost',
        path: '/',
        name: 'tab_cookie',
        expires: 7,
    },
    ...
});

Take a look at the documentation of the cookie plugin for more options you can set.

0

精彩评论

暂无评论...
验证码 换一张
取 消