You can certainly write cookies with JavaScript, yes. A simple web-search should reveal hundreds of examples. You can also use the JavaScript "timer" object to periodically check to see if a cookie has expired. So yeah, this could be done. However, it won't be secure.
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
Yes, it can be done, using the techniques I've already described. What specifically have you tried? At what point does it fail? You need to show us what you've already tried, what you already know, so we can help you properly.
As I said, there are lots of examples of how to read/write cookies with JavaScript, and the other object you'll need is the "timer" object.
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
Ok. I'll try to help, if you try to use apostrophes in your posts. Deal?
You set cookies using the "document.cookie" object. The arguments are name-value pairs:
document.cookie =
'cookieName=cookieValue; expires=Thu, 23 Feb 2006 20:47:11 UTC; path=/'
Three pairs: the cookie name and value, the expiration date-time, and the path.
To read the cookie:
var x = readCookie('cookieName')
if (x)
{
[do something with x]
}
Try that, make sure you can at least write and read the cookie. You do know how to at least create an HTML document with scripts, right?
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37