Click to See Complete Forum and Search --> : Setting a cookie in pure JS, not HTML


Yekusai
02-13-2003, 01:22 PM
Hello developers,

I am running a auto configuration .INS file on browser load, which in turn calls a .JS file (that one filters a list of URLs and points to appropriate proxies).

I would like to set a static cookie on client's machine in that .JS file.
As far as I know cookies are sent to the clien'ts box in HTTP header. Therefore it will not be possible to do so in pure JavaScript file.

Am I right, or is it possible?

If it is, I would appreciate an explanation and possibly an example.

Thanks!

Frustrated and c-c-c-c-old in Pennsylvania.

gil davis
02-13-2003, 04:20 PM
Originally posted by Yekusai
Am I right, or is it possible?Cookies can be set using JavaScript without the benefit of any HTTP headers. It's done all the time.If it is, I would appreciate an explanation and possibly an example.Any general cookie script will do this. There are tons of scripts. Look for the setCookie() function. The problem you will have is the domain part. Cookies cannot be shared across domains. If your application is on a server, only files located on the same server will be able to read the cookies.

Yekusai
02-14-2003, 09:32 AM
.