Closed Thread Icon

Topic awaiting preservation: Cookie Path question (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8832" title="Pages that link to Topic awaiting preservation: Cookie Path question (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Cookie Path question <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 08-23-2003 08:57

Hi, guys. How are you?
Can I ask you this:

code:
document.cookie = 'sitestyle=' + escape(style) + '; expires=' + expires.toGMTString() + '; path=/';



I am trying to understand what this code means. especially what is that last part of this code: path=/.

Help!

Hiroki Kozai

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-23-2003 10:06

The last part specifies the scope where cookie is available.

For example, lets say that your web site is located at www.example.com Now, you have a page www.example.com/folder1/index.html that sets a cookie with "path=/". That will make the cookie available to all pages (in all folders) on your web server (path=/ represents server root). Cookie will be available to www.example.com/folder1/index.html and to www.example.com/folder2/index.html as well. On the other hand if you want to limit cookie to specific folder (i.e. make it only available to folder1 and not to folder2 on your server), page www.example.com/folder1/index.html should set cookie with "path=/folder1/" and now cookie will be available to all pages in www.example.com/folder1/ folder *only*...

More information about other parameters :FAQ: http://faq.ozoneasylum.com/1048




[This message has been edited by mr.maX (edited 08-23-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu