storage-cookies-same-name.html (736B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Storage inspector cookies with duplicate names</title> 6 </head> 7 <body onload="createCookies()"> 8 <script type="application/javascript"> 9 "use strict"; 10 // eslint-disable-next-line no-unused-vars 11 function createCookies() { 12 document.cookie = "name=value1;path=/;"; 13 document.cookie = "name=value2;path=/path2/;"; 14 document.cookie = "name=value3;path=/path3/;"; 15 } 16 17 window.removeCookie = function (name) { 18 document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; 19 }; 20 21 window.clearCookies = function () { 22 const cookies = document.cookie; 23 for (const cookie of cookies.split(";")) { 24 window.removeCookie(cookie.split("=")[0]); 25 } 26 }; 27 </script> 28 </body> 29 </html>