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?

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

Same thing. Just disappears.

Firefox (since I have FireBug)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.