3

I was trying to set a session cookie in ReactJS using React-Cookie package and didn't mention any expiry. It created a session cookie,as expected, but my browser isn't deleting cookie when I close the browser.

Then to test things, I created a simple index.html file in a sepaerate(new project) directory and tried making session cookie

let randomValue = Math.ceil(Math.random() * 10000);
  document.cookie = "Fcookie=" + randomValue + "; path=/";

it Created session cookie but again my browser isn't deleting it at the end of browser session(when browser closes). I have tried it in chrome and microsoft edge. I have also verified that cookies created with expiration time are being deleted on their time. And cookie created without expiry time are indeed session cookies.

Fakhar
  • 53
  • 4

0 Answers0