userData 行為通過將數(shù)據(jù)寫入一個UserData存儲區(qū)(UserData store)來保存數(shù)據(jù),userData可以將數(shù)據(jù)以xml格式保存在客戶端計算機上,如果你用的是 Windows 2000 或者 Windows xp,是保存在C:/Documents and Settings/Liming/UserData/文件夾下(如果操作系統(tǒng)不是安裝在C盤,那么C就應該是操作系統(tǒng)所在的分區(qū))。該數(shù)據(jù)將一直存在,除非你人為刪除或者用腳本設(shè)置了該數(shù)據(jù)的失效期。userData行為提供了一個比Cookie更具有動態(tài)性和更大容量的數(shù)據(jù)結(jié)構(gòu)。每頁的UserData 存儲區(qū)數(shù)據(jù)大小可以達到64 Kb,每個域名可以達到640 Kb。userData 行為通過sessions為每個對象分配UserData存儲區(qū)。使用save和load方法將UserData存儲區(qū)數(shù)據(jù)保存在緩存(cache)中。一旦UserData存儲區(qū)保存以后,即使IE瀏覽器關(guān)閉或者刷新了,下一次進入該頁面,數(shù)據(jù)也能夠重新載入而不會丟失。出于安全的考慮,相同協(xié)議使用同一個文件夾保存UserData存儲區(qū)數(shù)據(jù)。
This is a global object (globalStorage) that maintains multiple PRivate storage areas that can be used to hold data over a long period of time (e.g. over multiple pages and browser sessions).
Specifically, the globalStorage object provides access to a number of different storage objects into which data can be stored. For example, if we were to build a web page that used globalStorage on this domain (developer.mozilla.org) we’d have the following storage object available to us:
globalStorage[’developer.mozilla.org’] - All web pages within the developer.mozilla.org sub-domain can both read and write data to this storage object.
A cookie is a small piece of information stored by the browser. Each cookie is stored in a name=value; pair called a crumb—that is, if the cookie name is “id” and you want to save the id’s value as “this”, the cookie would be saved as id=this. You can store up to 20 name=value pairs in a cookie, and the cookie is always returned as a string of all the cookies that apply to the page. This means that you must parse the string returned to find the values of individual cookies.
Cookies accumulate each time the property is set. If you try to set more than one cookie with a single call to the property, only the first cookie in the list will be retained.
You can use the Microsoft® JScript® split method to extract a value stored in a cookie.