JavaScript Deletes all cookie instance codes:
In general, it is the deletion of the specified cookie, of course, you can delete all cookies at once, the following is a piece of code to implement this function.
The code is as follows:
function ClearCookie () { var keys=document.cookie.match (/[^ =;] + (? =\=)/g); if (keys) { for (var i=keys.length;i--;) { document.cookie=keys[i]+ ') =0;expires= ' +new Date (0). toUTCString () }
Run the above function to clear all cookies. The code is simple, it is to get all the cookie array, and then through the for loop to set the cookie expiration, there is not much to introduce.
Related reading:
1.js manipulation cookies can be found in the section on how JavaScript operates cookies .
2. Operation Cookie plugin javascript application Cookie Encapsulation code chapter.
The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=9502
For more information, refer to: http://www.softwhy.com/javascript/
JavaScript Deletes all cookie instance codes