什麼是Cookie?
A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is a small piece of data sent from a website and stored in a user’s web browser while a user is browsing a website. When the user browses the same website in the future, the data stored in the cookie can be retrieved by the website to notify the website of the user’s previous activity. Cookies were designed to be a reliable mechanism for websites to remember the state of the website or activity the user had taken in the past. This can include clicking particular buttons, logging in, or a record of which pages were visited by the user even months or years ago.
(上面的解釋來時wikipedia)
在Windows系統上(這裏以Win7爲例)瀏覽器的Cookie
IE瀏覽器Cookie
IE瀏覽器Cookie數據位於:%APPDATA%\Microsoft\Windows\Cookies\ 目錄中的xxx.txt文件 (裏面可能有很多個.txt Cookie文件)
如:C:\Users\yren9\AppData\Roaming\Microsoft\Windows\Cookies\0WQ6YROK.txt
在IE瀏覽器中,IE將各個站點的Cookie分別保存爲一個XXX.txt這樣的純文本文件(文件個數可能很多,但文件大小都較小);而Firefox和Chrome是將所有的Cookie都保存在一個文件中(文件大小較大),該文件的格式爲SQLite3數據庫格式的文件。
一般WIN XP系統的IE cookie存放於 : C:/Documents and Settings/你的用戶名/Cookies 在cookies目錄裏就可以看到你所要想的cookie文件了,而且其內容也是很容易查看的。一般編輯器就可以打開查看了。
Firefox的Cookie
Firefox的Cookie數據位於:%APPDATA%\Mozilla\Firefox\Profiles\ 目錄中的xxx.default目錄,名爲cookies.sqlite的文件。
如:C:\Users\jay\AppData\Roaming\Mozilla\Firefox\Profiles\ji4grfex.default\cookies.sqlite
在Firefox中查看cookie, 可以選擇”工具 > 選項 >” “隱私 > 顯示cookie”。
一般WIN XP系統的FF cookie存放於:C:/Documents and Settings/你的用戶名/Application Data/Mozilla/Firefox/Profiles 在這個目錄下里有一個類似於這樣的隨機目錄 b8ypabix.default 。 b8ypabix.default裏面找到類似於cookies.sqlite等這樣的文件就是cookie文件,但是般普通編輯器是無法正常看到裏面的內容的。
如何查看 firefox的cookie
對此,firefox提供了一個“工具”來方便查看。依次點開FF瀏覽器工具選項: 工具》選項》隱私》在歷史選項框中選擇“使用自定義歷史記錄設置” 進入後,再選擇“顯示Cookies”.出來一個對話框,裏面就是FF記錄的所有Cookie。其值你也可以很方便查看到
Chrome的Cookie
Chrome的Cookie數據位於:%LOCALAPPDATA%\Google\Chrome\User Data\Default\ 目錄中,名爲Cookies的文件。
如:C:\Users\jay\AppData\Local\Google\Chrome\User Data\Default\Cookies
Linux系統上
在Linux系統上(以Ubuntu 12.04 和 RHEL6.x 爲例)瀏覽器的Cookie
Firefox的Cookie路徑爲:$HOME/.mozilla/firefox/xxxx.default/目錄下的cookie.sqlite文件。
master@jay-linux:~/.mozilla/firefox/tffagwsn.default$ ll cookies.sqlite-rw-r–r– 1 master master 1572864 Apr 21 16:54 cookies.sqlite
master@jay-linux:~/.mozilla/firefox/tffagwsn.default$ pwd/home/master/.mozilla/firefox/tffagwsn.default
WINDOWS上面
vista、win7的緩存以及臨時文件、Cookies和歷史記錄都在以下幾個地方:
緩存: %userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low
Temp: %userprofile%\AppData\Local\Temp\Low
Cookies: %userprofile%\AppData\Roaming\Microsoft\Windows\Cookies\Low
歷史: %userprofile%\AppData\Local\Microsoft\Windows\History\Low
參考資料:
http://hi.baidu.com/wqp2008wqp/item/45cd8f738edb5c2bd7a89c96
http://blog.csdn.net/teresa502/article/details/6199067
http://smilejay.com/2013/04/browser-cookie-location/
http://en.wikipedia.org/wiki/HTTP_cookie
http://www.milincorporated.com/a2_cookies.html
http://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data
http://superuser.com/questions/292952/chrome-cookies-folder-in-windows-7