How to delete a cookie using jQuery?

后端 未结 7 2165
终归单人心
终归单人心 2020-11-27 15:27

I want to use jQuery to delete cookies; I have tried this:

$.cookie(\'name\', \'\', { expires: -1 });

But when I refresh the page, the cookie

7条回答
  •  再見小時候
    2020-11-27 15:35

    it is the problem of misunderstand of cookie. Browsers recognize cookie values for not just keys also compare the options path & domain. So Browsers recognize different value which cookie values that key is 'name' with server setting option(path='/'; domain='mydomain.com') and key is 'name' with no option.

提交回复
热议问题