Unable to delete cookie from javascript

后端 未结 6 1185
名媛妹妹
名媛妹妹 2021-01-01 09:35

I am on an external site, and I am trying to delete the cookie via javascript.

I did the following in the console:

function deleteAllCookies() {
             


        
6条回答
  •  耶瑟儿~
    2021-01-01 10:23

    For me the issue was that I was setting the domain field which is required only if you overrode it when setting the cookie. Therefore, the following should do the trick:

    document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"
    

提交回复
热议问题