0

Hello

Im trying to make a cookie that I can use across one domain on different pages.

Lets say my domain is example.dev

var expiremilliseconds = 86400000;
var currdate = new Date();
var expirationdate = new Date(currdate.getTime() + expiremilliseconds);
document.cookie = "somecookie=true;domain=.example.dev;path=/;expires=" + expirationdate.toGMTString();

Thing is, I browse around my site and the cookie has disappeared and I cant use it on other pages. Why?

3
Contributors
6
Replies
21
Views
4 Years
Discussion Span
Last Post by riahc3
0

Have you tried the domain without the leading dot? It should be ignored, but I don't know how strict browsers are with this.

Edited by pritaeas

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.