Advertisement
Kawiesh

BM [Clear Cookies]

Apr 5th, 2020 (edited)
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript: var numCookies = 0;
  2. var cookieArray = document.cookie.split("; ");
  3. for (var i = 0; i < cookieArray.length && cookieArray[i]; i++) {
  4.   numCookies++;
  5.   for (var subDomain = "." + location.host; subDomain; subDomain = subDomain.replace(/^(?:%5C.|[^%5C.]+)/, "")) {
  6.     for (var curPath = location.pathname; curPath; curPath = curPath.replace(/.$/, "")) {
  7.       document.cookie = (cookieArray[i] + "; domain=" + subDomain + "; path=" + curPath + "; expires=" + new Date((new Date()).getTime() - 1e11).toGMTString());
  8.     }
  9.   }
  10. }
  11. alert("All data, including" + numCookies + " cookies cleared. Click OK to reload page :)");
  12. window.location.href = "http://" + window.location.host + window.location.pathname;
  13. (function() {
  14.   localStorage.clear();
  15.   var c = document.cookie.split("; ");
  16.   for (i in c) {
  17.     document.cookie = /^[^=]+/.exec(c[i])[0] + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
  18.   };
  19. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement