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!