Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
Why am I not able to set cookies on my device?

I am not able to set javascript cookies on my device for some reason. I am using this code:

<!DOCTYPE html>  
<html>  
<head>  
</head>  
<body>  
<input type="button" value="setCookie" onclick="setCookie()">  
<input type="button" value="getCookie" onclick="getCookie()">  
    <script>  
    function setCookie()  
    {  
        document.cookie="username=Duke Martin";  
    }  
    function getCookie()  
    {  
        if(document.cookie.length!=0)  
        {  
        alert(document.cookie);  
        }  
        else  
        {  
        alert("Cookie not available");  
        }  
    }  
    </script>  
  
</body>  
</html>

I have tried setting different cookie codes from different websites on different browsers , but none of them work. The thing is that even codes from w3schools which set cookies on my friend's device are not able to set cookies on my device .Could you please tell me if there is some sort of debugger so that I can make cookies work? P.S.: I have tried over 15 cookie codes in the past 3 hours but I am not able to set any cookies! Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Check if your browser has local cookies support turned on!

If you are using your browser in incognito mode:

In Incognito, none of your browsing history, cookies and site data, or information entered in forms are saved on your device.

If you are using Chrome:

Chrome ignores cookies from local pages. see: Cannot set cookies in Javascript

What do you get if you try to read out your set cookie in the console?

document.cookie = "username=John Doe";
document.cookie;

My result in Mozilla Firefox Version 101.0

'username=John Doe'

My result in Chrome Version 102.0.5005.63

''
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!