Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check cookie existence js

document.cookie = "hacker=anthony; SameSite=None; Secure";

   function checkACookieExists() {
       if (document.cookie.split(';').some((item) => item.trim().startsWith('hacker='))) {
            const output = document.getElementById('a-cookie-existence')
              output.textContent = '> The cookie "hacker" exists'
            }
        }

        function clearOutputACookieExists() {
            const output = document.getElementById('a-cookie-existence')
            output.textContent = ''
        }
 
PREVIOUS NEXT
Tagged: #check #cookie #existence #js
ADD COMMENT
Topic
Name
6+6 =