• userData Behavior


    https://msdn.microsoft.com/zh-cn/vstudio/ms531424
    userData Behavior

    This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

    Enables the object to persist data in user data.

    Syntax

    XML <Prefix: CustomTag ID=sID STYLE=" behavior:url('#default#userData')" />
    HTML <ELEMENT STYLE="behavior:url('#default#userData')" ID=sID>
    Scripting objectstyle.behavior = "url('#default#userData')"
    objectaddBehavior ("#default#userData")

    Possible Values

    Prefix Prefix that associates the CustomTag with an XML namespace. This prefix is set using the XMLNS attribute of the HTML tag.
    CustomTag User-defined tag.
    sID String that specifies a unique identifier for the object.
     

    Members Table

    The following table lists the members exposed by the userData object.

    Attributes/Properties
    PropertyDescription
    expires Sets or retrieves the expiration date of data persisted with the userData behavior.
    XMLDocument Retrieves a reference to the XML
    Methods
    MethodDescription
    getAttribute Retrieves the value of the specified attribute.
    load Loads an object participating in userData persistence from a UserData store.
    removeAttribute Removes the specified attribute from the object.
    save Saves an object participating in userData persistence to a UserData store.
    setAttribute Sets the value of the specified attribute.

    Remarks

    security note Security Alert  For security reasons, a UserData store is available only in the same directory and with the same protocol used to persist the store.
    security note Security Alert  Using this behavior incorrectly can compromise the security of your application. Data in a UserData store is not encrypted and therefore not secure. Any application that has access to the drive where UserData is saved has access to the data. Therefore, it is recommended that you not persist sensitive data like credit card numbers. For more information, see Security Considerations: DHTML and Default Behaviors.

    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 depends on the security zone of the domain. The following table shows the maximum amount of UserData storage that is available for an individual document and also the total available for an entire domain, based on the security zone.

    Security ZoneDocument Limit (KB)Domain Limit (KB)
    Local Machine 128 1024
    Intranet 512 10240
    Trusted Sites 128 1024
    Internet 128 1024
    Restricted 64 640

    See URLACTION_HTML_USERDATA_SAVE for information on how the userData behavior is regulated. See About URL Security Zones Templates for further information on the default URL policy settings for each of the five security zone templates.

    The userData behavior persists data across sessions, using one UserData store for each object. The UserData store is persisted in the cache using thesave and load methods. Once the UserData store has been saved, it can be reloaded even if the document has been closed and reopened.

    Setting the userData behavior class on the htmlheadtitle, 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> 
          .storeuserData {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.

    Examples

    This example uses the userData behavior to preserve information in a UserData Store.

    <html> 
     
    <head> 
    <style type="text/css"> 
    .storeuserData { 
        behavior: url(#default#userData); 

    </style> 
    <script type="text/javascript"> 
    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="storeuserData" type="text" id="oPersistInput"> 
        <input type="button" value="Load" onclick="fnLoadInput()"> 
        <input type="button" value="Save" onclick="fnSaveInput()"> 
    </form> 
     
    </body> 
     
    </html>

    Code examplehttp://samples.msdn.microsoft.com/workshop/samples/author/persistence/userData_1.htm

    The following example uses the userData behavior in a custom tag to preserve information in a UserData Store.

    <html xmlns:sdk=""> 
     
    <head> 
    <style type="text/css"> 
    sdk:cacher { 
        behavior: url(#default#userData); 

    </style> 
    <script type="text/javascript"> 
    function fnSaveInput(){ 
       cachetag.setAttribute("sPersist",txt1.value); 
       cachetag.save("cache"); 

    function fnLoadInput(){ 
       cachetag.load("cache"); 
       cachetag.value=cachetag.getAttribute("sPersist"); 

    </script> 
    </head> 
     
    <body> 
     
    <sdk:cacher id="cachetag"></sdk:cacher> 
    <input type="button" value="Load" onclick="fnLoadInput()"> 
    <input type="button" value="Save" onclick="fnSaveInput()"> 
    <input type="text" id="txt1" value="some value"> 
     
    </body> 
     
    </html>

    Applies To

      AABBRACRONYMADDRESSAREABBIGBLOCKQUOTEBUTTONCAPTIONCENTERCITECODEDDDELDFNDIRDIVDLDTEMFONT,FORMhnHRIIMGINPUT type=buttonINPUT type=checkboxINPUT type=fileINPUT type=hiddenINPUT type=imageINPUT type=password,INPUT type=radioINPUT type=resetINPUT type=submitINPUT type=textKBDLABELLILISTINGMAPMARQUEEMENUOBJECTOLOPTION,PPLAINTEXTPREQSSAMPSELECTSMALLSPANSTRIKESTRONGSUBSUPTABLETEXTAREATTUULVARXMP

    See Also

     
  • 相关阅读:
    格式化日期为yyyy-MM-dd
    JavaScript 原型
    SSD 车辆检测 实现
    Unity模拟自动驾驶方向盘角度预测
    交通标识牌识别
    cifar-10 No such file or directory: '/home/ /.keras/datasets/cifar-10-batches-py/data_batch_1'
    Keras 使用多层感知器 预测泰坦尼克 乘客 生还概率
    else
    Keras源码下载记录
    import cv2 失败 ImportError:DLL load fail:找不到指定模块
  • 原文地址:https://www.cnblogs.com/jijm123/p/8433678.html
Copyright © 2020-2023  润新知