Original address: http://java-zone.org/1052.html
The cookie has path--path, which indicates which path the file has permission to read from the cookie.
Path should end with "/", cookie of the same name, different path, different cookie
Document.cookie = "n1=1; path=/path/";
Document.cookie = "n1=2; Path=/path ";
Document.cookie = "n1=3; path=path/";
As the above code, the first two sentences relative to the site root directory of the Web page, the third sentence is used relative to the current directory path.
The first sentence and the second sentence are different, although they express the same permissions, but because the path string different, will form two of the same name of the cookie, easy to cause confusion, we recommend the use of the first sentence of this format, because the system default is also "/" end.
So if the above is three cookies, there is no overlap between them.
The Path property value is case-sensitive and should match the input of the address bar in the browser
Document.cookie = "n1=1; path=/path/";
Document.cookie = "n1=2; path=/path/";
This is a two different cookie, because the Path property value is different case, if we enter path in the address bar, then read the first N1, if we enter path, then read the second N1
Path is not readable
As with expires, path is only writable and unreadable.
Path cannot be changed
Unlike expires, if we try to change path, we actually write another cookie instead of changing the path value.
Path Permission is inherited
If the/test/directory is specified to have permission to read a cookie, the directory/test/t/under/test/also has permission to read the cookie.
How to correctly use the cookie path in detail