Allowing some foreign server program to read from and write to your hard disk may give you pause, but browser cookie mechanisms do not just open up your drive's directory for the world to see (and to corrupt).
Instead, the cookie mechanism provides access to a type of text file (Internet Explorer) or just one special text file (browsers other than IE) located in a platform-specific spot on your drive.
In Mozilla-based browsers, for example, the cookie file is named cookies.txt and is locate in a directory (whose name ends in .slt) within the browser's profile area. In Mac OSX, the location is [user]/Library/Mozilla/Profiles/[profilename]/.
Internet Explorer for Windows uses a different filing system: all cookies for each domain are saved in a domain-specific file inside the
C:\\Windows\Temporary Internet Files\
directory.
Filenames begin with Cookie: and include the username and domain of the server that wrote the cookie. Safari cookies are recorded in an XML file named Cookies.plist within the [user]/Library/Cookies/ directory.
Opera cookies are recorded in a binary file named cookies4.dat within the [user]\Application Data\Opera\Opera directory.
Google Chrome cookies are recorded in a SQLite database file named Cookies within the
[user]\Local Settings\Application Data\Google\Chrome\User Data\Default
directory.
Be aware that if you are testing with Google Chrome, your code will not work unless the files are coming from an HTTP server.
Chrome intentionally disables cookies on file:/// documents.
A cookie file is a text file. If curiosity drives you to open a cookie file, we recommend that you do so only with a copy saved in another directory or folder. Any alteration to the existing file can mess up whatever valuable cookies are stored there for sites you regularly visit. The data format for cookie files differs across browsers, in line with the different methodologies used for filing cookies. Inside the Mozilla file (after a few comment lines warning you not to manually alter the file) are lines of tab-delimited text.
Each return-delimited line contains one cookie’s information. The cookie file is just like a text listing of a database.
In each of the IE cookie files, the same data points are stored for a cookie as for Mozilla, but the items are in a return-delimited list. The structure of these files is of no importance to scripting cookies, because all browsers utilize the same syntax for reading and writing cookies through the document.cookie property.