简体   繁体   中英

clear cookies of a website using devtools console

We can delete localstorage or sessionstorage using js clear() like

localStorage.clear();
sessionStorage.clear()

Is there no like this?这样的吗? How? (No chrome extension please)

The quickest I found to clear, clicking on secure icon near website in address bar > cookies > Remove.

This is some code that I found at https://stackoverflow.com/a/27374365/10022239

 document.cookie.split(";").forEach(function(c) { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/"); });

You may also be able to use cookies.remove();

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/cookies/remove

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM