Setting a cookie with a more specific path is fine in all js+cookie enabled browsers?

just want to check:

javascript used to set (not read) a cookie whose path is more specific (e.g. ‘/test’) than the document’s path which is doing the setting (e.g. from an html file in the html root directory) will work fine?

it worked fine (that is the cookie was successfully set) in two browsers i just checked it in, an old safari and an old firefox.

so can i expect this to work in all browsers (those which have both js and cookie capabilities both turned on)? or are there some that will not allow this?


Path specific cookies should work fine in all browsers, an example i found shows a path specific setcookie function

All browsers accept cookies, its just a matter of the user allowing there browser to accept the cookie which is very rare to find someone who doesn’t

it’s the path aspect i’m asking about though. reading a cookie whose path is /test/ from within a document whose location is / on the server is not possible – browsers don’t allow that. setting such a cookie is possible though it seems – at least in the two browsers i tested in. is this fine/possible in all other browsers?


ok great, thanks. i imagined that some browsers might not allow you to set more specifically pathed cookies than the document doing the setting. i was surprised my browsers allowed it. i guess it’s not a problem for that to happen. good. thanks.