JavaScript bookmarklet to delete all cookies within a given domain

后端 未结 2 1649
悲哀的现实
悲哀的现实 2020-12-31 04:25

I am testing a web app that writes cookies to subdomain.thisdomain.com and several subfolders within that. I\'m looking for JavaScript that I can put into a bookmarklet that

相关标签:
2条回答
  • 2020-12-31 05:12

    Derived from my answer here:

    javascript:new function(){var c=document.cookie.split(";");for(var i=0;i<c.length;i++){var e=c[i].indexOf("=");var n=e>-1?c[i].substr(0,e):c[i];document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT";}}(); return void(0);
    

    Due to browser security issues, this will only work when executed while on a page that has access to all the cookies you want to delete.

    0 讨论(0)
  • 2020-12-31 05:23

    I would recommend Firecookie extension to Firebug.

    0 讨论(0)
提交回复
热议问题