userData Behavior
Enables the object to persist data in user data.
Syntax
XML N/A HTML <ELEMENT STYLE="behavior:url('#default#userData')" ID=sID> Scripting object.style.behavior = "url('#default#userData')" object.addBehavior ("#default#userData")
Possible Values
sID String that specifies a unique identifier for the object.
Members
Remarks
The userData behavior persists information across sessions by writing to a UserData store. This provides a data structure that is more dynamic and has a greater capacity than cookies. The capacity of the UserData store is 64K per page, with a limit of 640K per domain.
The userData behavior persists data across sessions, using one UserData store for each object. The UserData store is persisted in the cache using the save and load methods. Once the UserData store has been saved, it can be reloaded even if Microsoft® Internet Explorer has been closed and reopened.
For security reasons, a UserData store is available only in the same directory and with the same protocol used to persist the store.
Setting the userData behavior (proposed) class on the HTML, HEAD, TITLE, or STYLE object causes an error when the save or load method is called.
The required STYLE can be set inline or in the document header, as follows:
<STYLE> .userData {behavior:url(#default#userdata);} </STYLE>An ID is optional for userData, but including one improves performance.
The userData behavior is available as of Microsoft® Internet Explorer 5, in the Microsoft® Win32® and Unix platforms.
Example
This example uses the userData behavior to preserve information in a UserData Store.
Sample Code
<HTML> <HEAD> <STYLE> .userData {behavior:url(#default#userdata);} </STYLE> <SCRIPT> function fnSaveInput(){ var oPersist=oPersistForm.oPersistInput; oPersist.setAttribute("sPersist",oPersist.value); oPersist.save("oXMLBranch"); } function fnLoadInput(){ var oPersist=oPersistForm.oPersistInput; oPersist.load("oXMLBranch"); oPersist.value=oPersist.getAttribute("sPersist"); } </SCRIPT> </HEAD> <BODY> <FORM ID="oPersistForm"> <INPUT CLASS="userData" TYPE="text" ID="oPersistInput"> <INPUT TYPE="button" VALUE="Load" onclick="fnLoadInput()"> <INPUT TYPE="button" VALUE="Save" onclick="fnSaveInput()"> </FORM> </BODY> </HTML>
Applies To
[ Object Name ] Platform Version Win16: Win32: Mac: Unix: WinCE: Version data is listed when the mouse hovers over a link, or the link has focus. A, ACRONYM, ADDRESS, AREA, B, BIG, BLOCKQUOTE, BUTTON, CAPTION, CENTER, CITE, CODE, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, Hn, HR, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, KBD, LABEL, LI, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TEXTAREA, TT, U, UL, VAR, XMP
See Also
dhtml behaviors, persistence overview
Did you find this topic useful? Suggestions for other topics? write us!
© 1999 microsoft corporation. all rights reserved. terms of use.