0

I am making a .html file that is meant to be open locally, therefore not accessed via http:// but via file:///

Firefox rejects the cookie I try to create in javascript, saying there is already a cookie HTTP-Only: document.cookie = cname + "=" + cvalue + ";expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/;HttpOnly;SameSite=Strict;";

Is there a way to use cookies for a local page ?

Pierre
  • 145
  • 1
  • 15

2 Answers2

1

Cookies are not set for local pages via file:///. See here for more information: Setting Cookies using JavaScript in a local html file

Oscar Umhin
  • 44
  • 1
  • 3
1

Browsers do not store cookies for the file:// url protocol, although it may depend on the browser anyway

e.g launching chrome with --enable-file-cookies

Mab
  • 412
  • 3
  • 12